Skip to content

GH-117087: Initial implementation of support for 'code like' objects in sys.monitoring #131414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Mar 18, 2025

Initial implementation of "code like" object support.

  • Adds methods to code object to implement the "code like" interface
  • Adds support for code-like objects in sys.monitoring

This is something to play with.
Obviously, this it will need more tests, especially for a C implemented code-like, and documentation.

@scoder @da-woods how does this look to you?

@da-woods
Copy link
Contributor

As you say in the issue: some of this is only worth doing when most of the monitoring tools also accept code objects. So I suspect we'd have to make Cython switchable between real and fake code objects for a while. But it looks reasonably straightforward.

@markshannon
Copy link
Member Author

A code object is "code like", so if Cython is already creating code objects, then it might as well continue to do so.

However, Cython created code objects are never going to be "proper" code objects, as they won't have bytecode, so I think trying to find an interface that is sufficient to support coverage, pdb, inspect, etc. and is implementable by Cython, Numba, Mypyc, etc. is worthwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants