-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
[C-API] Add a function to access PyCodeObject.co_code in C #92154
Comments
See also #91397 "[C API] Move the PyCodeObject structure to the internal C API (make the structure opaque)". |
Even if no function is added, please document at least the member removal in https://docs.python.org/dev/whatsnew/3.11.html (C API > Porting to Python 3.11) since the PyCodeObject structure is part of the public C API. |
Exposing |
Sounds good to me as well. |
And I added the function to pythoncapi-compat: python/pythoncapi-compat@85d1bd8 |
Feature or enhancement
Previously, you could access the
co_code
field inPyCodeObject
directly to access the bytecode. This is no longer the case since 2bde682. Currently in 3.11a7+, C code cannot easily obtain the equivalent ofco_code
in 3.10.co_code_adaptive
gets quickened bytecode which is not equivalent to the 3.10 behavior.I would imagine many tools relying on the old behavior will break.
Pitch
I propose we expose some form of the currently internal
_PyCode_GetCode
.Previous discussion
Related to #91397.
See also coverage.py issue nedbat/coveragepy#1367
CC @vstinner @nedbat @brandtbucher @markshannon
The text was updated successfully, but these errors were encountered: