msg298545 - (view) |
Author: Alex (jalexvig) * |
Date: 2017-07-17 17:29 |
The documentation for co_names in the inspect module is: "tuple of names of local variables" Local variable names are however in co_varnames while co_names contains global variable names. This description should read: "tuple of names of global variables" Relevant StackOverflow post here: https://stackoverflow.com/q/45147260/1953800 |
|
|
msg298644 - (view) |
Author: Marco Buttu (marco.buttu) * |
Date: 2017-07-19 08:49 |
Or maybe: "tuple of names of global variables used in the bytecode" |
|
|
msg330300 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2018-11-23 08:58 |
co_names contains not only names of global variables. It contains also local names in the class scope, attribute names, names of imported modules, etc. |
|
|
msg334563 - (view) |
Author: Utkarsh Gupta (utkarsh2102) * |
Date: 2019-01-30 14:54 |
Serhiy: What change d'you possibly suggest then? |
|
|
msg372358 - (view) |
Author: Xavier Morel (xmorel) * |
Date: 2020-06-25 12:09 |
Maybe something along the lines of "names other than arguments and function locals", or "names of the symbols used in the code object, other than arguments and function locals"? This is still slightly confusing because in the case of an import the name is present in both mappings, but less so than the outright lie of the current version. Serhiy, is there a way to access the class's code object from Python? Also does that mean varnames is not used by class code objects despite it stating unambiguously that it stores locals? |
|
|
msg402547 - (view) |
Author: Łukasz Langa (lukasz.langa) *  |
Date: 2021-09-24 10:05 |
New changeset 3f8b23f8ddab75d9b77a3997d54e663187e12cc8 by Alex Vig in branch 'main': bpo-30951: Correct co_names docstring in inspect module (GH-2743) https://github.com/python/cpython/commit/3f8b23f8ddab75d9b77a3997d54e663187e12cc8 |
|
|
msg402548 - (view) |
Author: Łukasz Langa (lukasz.langa) *  |
Date: 2021-09-24 10:38 |
New changeset 91a5ba1bcb24c87a82c1417b1e5df57c89cbd3e0 by Miss Islington (bot) in branch '3.9': bpo-30951: Correct co_names docstring in inspect module (GH-2743) (GH-28544) https://github.com/python/cpython/commit/91a5ba1bcb24c87a82c1417b1e5df57c89cbd3e0 |
|
|
msg402549 - (view) |
Author: Łukasz Langa (lukasz.langa) *  |
Date: 2021-09-24 10:38 |
New changeset 402d5f3d77684c91ad02a2ab5223673bec5f1602 by Miss Islington (bot) in branch '3.10': bpo-30951: Correct co_names docstring in inspect module (GH-2743) (GH-28543) https://github.com/python/cpython/commit/402d5f3d77684c91ad02a2ab5223673bec5f1602 |
|
|
msg402550 - (view) |
Author: Łukasz Langa (lukasz.langa) *  |
Date: 2021-09-24 10:39 |
Thanks, Alex! ✨ 🍰 ✨ |
|
|
msg403159 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-10-04 19:18 |
New changeset 7d652c1b7a56524fec42f65d9be28c17888075ab by Pablo Galindo (Miss Islington (bot)) in branch '3.10': bpo-30951: Correct co_names docstring in inspect module (GH-2743) (GH-28543) https://github.com/python/cpython/commit/7d652c1b7a56524fec42f65d9be28c17888075ab |
|
|