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 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Fidget-Spinner commentedMay 2, 2022
Feature or enhancement
Previously, you could access the
co_codefield inPyCodeObjectdirectly to access the bytecode. This is no longer the case since 2bde682. Currently in 3.11a7+, C code cannot easily obtain the equivalent ofco_codein 3.10.co_code_adaptivegets 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: