Skip to content
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

Documentation error in inspect module #75134

Closed
jalexvig mannequin opened this issue Jul 17, 2017 · 10 comments
Closed

Documentation error in inspect module #75134

jalexvig mannequin opened this issue Jul 17, 2017 · 10 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@jalexvig
Copy link
Mannequin

jalexvig mannequin commented Jul 17, 2017

BPO 30951
Nosy @masklinn, @ambv, @serhiy-storchaka, @marco-buttu, @laike9m, @jalexvig, @pablogsal, @miss-islington, @utkarsh2102
PRs
  • bpo-30951: Documentation fix co_names (inspect module) #2742
  • bpo-30951: Correct co_names documentation in inspect module #2743
  • bpo-30951: Rename local variables to global variables in Lib/inspect.py #10668
  • [3.10] bpo-30951: Correct co_names docstring in inspect module (GH-2743) #28543
  • [3.9] bpo-30951: Correct co_names docstring in inspect module (GH-2743) #28544
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-09-24.10:39:41.795>
    created_at = <Date 2017-07-17.17:29:35.640>
    labels = ['3.11', 'type-bug', '3.9', '3.10', 'docs']
    title = 'Documentation error in inspect module'
    updated_at = <Date 2021-10-04.19:18:42.585>
    user = 'https://github.com/jalexvig'

    bugs.python.org fields:

    activity = <Date 2021-10-04.19:18:42.585>
    actor = 'pablogsal'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2021-09-24.10:39:41.795>
    closer = 'lukasz.langa'
    components = ['Documentation']
    creation = <Date 2017-07-17.17:29:35.640>
    creator = 'jalexvig'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30951
    keywords = ['patch']
    message_count = 10.0
    messages = ['298545', '298644', '330300', '334563', '372358', '402547', '402548', '402549', '402550', '403159']
    nosy_count = 10.0
    nosy_names = ['xmorel', 'docs@python', 'lukasz.langa', 'serhiy.storchaka', 'marco.buttu', 'laike9m', 'jalexvig', 'pablogsal', 'miss-islington', 'utkarsh2102']
    pr_nums = ['2742', '2743', '10668', '28543', '28544']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30951'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @jalexvig
    Copy link
    Mannequin Author

    jalexvig mannequin commented Jul 17, 2017

    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

    @jalexvig jalexvig mannequin added the 3.7 (EOL) end of life label Jul 17, 2017
    @jalexvig jalexvig mannequin assigned docspython Jul 17, 2017
    @jalexvig jalexvig mannequin added the docs Documentation in the Doc dir label Jul 17, 2017
    @marco-buttu
    Copy link
    Mannequin

    marco-buttu mannequin commented Jul 19, 2017

    Or maybe: "tuple of names of global variables used in the bytecode"

    @serhiy-storchaka
    Copy link
    Member

    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.

    @utkarsh2102
    Copy link
    Mannequin

    utkarsh2102 mannequin commented Jan 30, 2019

    Serhiy: What change d'you possibly suggest then?

    @csabella csabella added 3.8 only security fixes 3.9 only security fixes and removed 3.7 (EOL) end of life labels Jan 20, 2020
    @masklinn
    Copy link
    Mannequin

    masklinn mannequin commented Jun 25, 2020

    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?

    @ambv
    Copy link
    Contributor

    ambv commented Sep 24, 2021

    New changeset 3f8b23f by Alex Vig in branch 'main':
    bpo-30951: Correct co_names docstring in inspect module (GH-2743)
    3f8b23f

    @ambv
    Copy link
    Contributor

    ambv commented Sep 24, 2021

    New changeset 91a5ba1 by Miss Islington (bot) in branch '3.9':
    bpo-30951: Correct co_names docstring in inspect module (GH-2743) (GH-28544)
    91a5ba1

    @ambv
    Copy link
    Contributor

    ambv commented Sep 24, 2021

    New changeset 402d5f3 by Miss Islington (bot) in branch '3.10':
    bpo-30951: Correct co_names docstring in inspect module (GH-2743) (GH-28543)
    402d5f3

    @ambv
    Copy link
    Contributor

    ambv commented Sep 24, 2021

    Thanks, Alex! ✨ 🍰 ✨

    @ambv ambv added 3.10 only security fixes 3.11 only security fixes and removed 3.8 only security fixes labels Sep 24, 2021
    @ambv ambv closed this as completed Sep 24, 2021
    @ambv ambv added the type-bug An unexpected behavior, bug, or error label Sep 24, 2021
    @pablogsal
    Copy link
    Member

    New changeset 7d652c1 by Pablo Galindo (Miss Islington (bot)) in branch '3.10':
    bpo-30951: Correct co_names docstring in inspect module (GH-2743) (GH-28543)
    7d652c1

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants