Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-30951: Correct co_names documentation in inspect module #2743
Conversation
the-knights-who-say-ni
commented
Jul 17, 2017
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
mention-bot
commented
Jul 17, 2017
@jalexvig, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Yhg1s, @1st1 and @zestyping to be potential reviewers. |
@@ -268,7 +268,7 @@ def iscode(object): | |||
co_kwonlyargcount number of keyword only arguments (not including ** arg) | |||
co_lnotab encoded mapping of line numbers to bytecode indices | |||
co_name name with which this code object was defined | |||
co_names tuple of names of local variables | |||
co_names tuple of names of global variables |
This comment has been minimized.
This comment has been minimized.
marco-buttu
Jul 18, 2017
Contributor
What about tuple of names of global variables used in the bytecode?
This comment has been minimized.
This comment has been minimized.
jalexvig
Jul 20, 2017
Author
This description is currently under the code
type... The other descriptions don't make explicit reference to bytecode (except for co_consts
) since it is implied by the code
type. Would be pretty repetitive to add reference to the bytecode in every description. Thoughts?
This comment has been minimized.
This comment has been minimized.
bitdancer
Jul 20, 2017
Member
The difference here is that "tuple of names of global variables" would be potentially misleading, since only those global variables used by the bytecode are included. (IIUC) This item is parallel to co_consts in that sense.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@jalexvig, please take a look at incorporating the note from @serhiy-storchaka in your change. Thanks! |
Added the |
So I'm guessing, |
@jalexvig ping |
Kindly ping |
I haven't looked at this in a while, but updated with suggestion from Xavier Morel. |
jalexvig commentedJul 17, 2017
•
edited by bedevere-bot
Previously
co_names
was described as containing names of local variables.co_names
however contains names of global variables (co_varnames
contains local variable names). Documentation was updated to reflect this.Relevant stackoverflow post:
https://stackoverflow.com/questions/45147260/what-is-co-names
https://bugs.python.org/issue30951