Navigation Menu

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

PyList_GetItem() document: index can be 0 #81668

Closed
ghost opened this issue Jul 2, 2019 · 6 comments
Closed

PyList_GetItem() document: index can be 0 #81668

ghost opened this issue Jul 2, 2019 · 6 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@ghost
Copy link

ghost commented Jul 2, 2019

BPO 37487
Nosy @terryjreedy
PRs
  • bpo-37487: Fix PyList_GetItem index description. #14623
  • [3.8] bpo-37487: Fix PyList_GetItem index description. (GH-14623) #14624
  • [3.7] bpo-37487: Fix PyList_GetItem index description. (GH-14623) #14625
  • [2.7] bpo-37487: Fix PyList_GetItem index description. (GH-14623) #14626
  • 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 = 'https://github.com/terryjreedy'
    closed_at = <Date 2019-07-06.21:56:26.551>
    created_at = <Date 2019-07-02.14:49:41.749>
    labels = ['3.8', 'type-bug', '3.7', '3.9', 'docs']
    title = 'PyList_GetItem() document: index can be 0'
    updated_at = <Date 2019-07-06.21:56:26.550>
    user = None

    bugs.python.org fields:

    activity = <Date 2019-07-06.21:56:26.550>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2019-07-06.21:56:26.551>
    closer = 'terry.reedy'
    components = ['Documentation']
    creation = <Date 2019-07-02.14:49:41.749>
    creator = '\xe6\x9d\xa8\xe6\x98\x86\xe4\xbb\x91'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37487
    keywords = ['patch']
    message_count = 6.0
    messages = ['347144', '347373', '347444', '347446', '347447', '347448']
    nosy_count = 3.0
    nosy_names = ['terry.reedy', 'docs@python', '\xe6\x9d\xa8\xe6\x98\x86\xe4\xbb\x91']
    pr_nums = ['14623', '14624', '14625', '14626']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue37487'
    versions = ['Python 2.7', 'Python 3.7', 'Python 3.8', 'Python 3.9']

    @ghost
    Copy link
    Author

    ghost commented Jul 2, 2019

    The document of this function (PyList_GetItem()) says: "Return the object at position index in the list pointed to by list. The position must be **positive**,". However test shows the correct position index should be from 0 to len(list)-1. The claim of index **must be positive** is inaccurate and confusing.

    @ghost ghost assigned docspython Jul 2, 2019
    Repository owner added docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error labels Jul 2, 2019
    @terryjreedy
    Copy link
    Member

    Good catch. (In the future, try to include the url, as below.)

    The full sentence in question, at https://docs.python.org/3/c-api/list.html#c.PyList_GetItem, is "The position must be positive, indexing from the end of the list is not supported." 'positive' should be 'non-negative'. The next sentence deal with out-of-bounds positions, and these could be specified as '(< 0, > len(list))'

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes labels Jul 6, 2019
    @terryjreedy terryjreedy changed the title PyList_GetItem() document regarding index PyList_GetItem() document: index can be 0 Jul 6, 2019
    @terryjreedy terryjreedy assigned terryjreedy and unassigned docspython Jul 6, 2019
    @terryjreedy
    Copy link
    Member

    New changeset f8709e8 by Terry Jan Reedy in branch 'master':
    bpo-37487: Fix PyList_GetItem index description. (GH-14623)
    f8709e8

    @terryjreedy
    Copy link
    Member

    New changeset ad37203 by Terry Jan Reedy (Miss Islington (bot)) in branch '3.8':
    bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14624)
    ad37203

    @terryjreedy
    Copy link
    Member

    New changeset 9c930d0 by Terry Jan Reedy (Miss Islington (bot)) in branch '3.7':
    bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14625)
    9c930d0

    @terryjreedy
    Copy link
    Member

    New changeset dd3862e by Terry Jan Reedy (Miss Islington (bot)) in branch '2.7':
    bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14626)
    dd3862e

    @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.7 (EOL) end of life 3.8 only security fixes 3.9 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

    2 participants