GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add `PyList_GetItemRef`, a variant of `PyList_GetItem` that returns a strong reference · Issue #114329 · python/cpython

Add PyList_GetItemRef, a variant of PyList_GetItem that returns a strong reference #114329

New issue
Copy link
New issue
Copy link
Closed
Closed
Add PyList_GetItemRef, a variant of PyList_GetItem that returns a strong reference#114329
Copy link
Labels
topic-C-APItopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement

Description

@colesbury
colesbury
opened on Jan 19, 2024
Issue body actions

Feature or enhancement

The free-threaded builds need a variant of PyList_GetItem that returns a strong reference instead of a borrowed reference for thread-safety reasons. PEP 703 proposed PyList_FetchItem, but since then PyDict_GetItemRef and functions with similar signatures have been added.

This proposes PyList_GetItemRef with the following signature:

PyObject *PyList_GetItemRef(PyObject *list, Py_ssize_t index)

Return a strong reference to the object at position index in the list pointed to by list. If index is out of bounds (<0 or >=len(list)), return NULL and set an IndexError. If list is not a list instance, return NULL and set a TypeError.

Linked PRs

  • gh-114329: Add PyList_GetItemRef function #114504
  • gh-114329: Fix PyList_GetItemRef() limited C API definition #117520

Activity

  1. colesbury
    added
    type-featureA feature request or enhancementA feature request or enhancement
    topic-C-API
    3.13only security fixesonly security fixes
    topic-free-threading
    on Jan 19, 2024
  2. colesbury commented on Jan 19, 2024

    @colesbury
    colesbury
    on Jan 19, 2024
    ContributorAuthor
    More actions

    C-API working group issue: capi-workgroup/decisions#9

  3. Eclips4 commented on Jan 19, 2024

    @Eclips4
    Eclips4
    on Jan 19, 2024
    Member
    More actions

    Just FYI, feature requests do not need version label :)

    Reacted by Sam Gross
  4. Eclips4
    removed
    3.13only security fixesonly security fixes
    on Jan 19, 2024
  5. colesbury
    added 2 commits that reference this issue on Jan 23, 2024

    pythongh-114329: Add `PyList_GetItemRef` function

    8f96d08

    Merge branch 'main' into pythongh-114329-list

    c045495
  6. encukou
    added a commit that references this issue on Feb 2, 2024

    gh-114329: Add `PyList_GetItemRef` function (GH-114504)

    d0f1307
  7. encukou commented on Feb 2, 2024

    @encukou
    encukou
    on Feb 2, 2024
    Member
    More actions

    Thank you!

  8. encukou
    closed this as completedon Feb 2, 2024
  9. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-114329: Add `PyList_GetItemRef` function (pythonGH-114504)

    445e147
  10. fsc-eriker
    added a commit that references this issue on Feb 14, 2024

    pythongh-114329: Add `PyList_GetItemRef` function (pythonGH-114504)

    d3c77d1
  11. vstinner
    added 3 commits that reference this issue on Apr 3, 2024

    pythongh-114329: Fix PyList_GetItemRef() limited C API definition

    450b389

    pythongh-114329: Fix PyList_GetItemRef() limited C API definition

    934a220

    gh-114329: Fix PyList_GetItemRef() limited C API definition (#117520)

    2057c92
  12. diegorusso
    added a commit that references this issue on Apr 17, 2024

    pythongh-114329: Fix PyList_GetItemRef() limited C API definition (py…

    47e396c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-C-APItopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.