-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Add PyList_GetItemRef
, a variant of PyList_GetItem
that returns a strong reference
#114329
Closed
Tracked by
#108219
Labels
Comments
colesbury
added
type-feature
A feature request or enhancement
topic-C-API
3.13
bugs and security fixes
topic-free-threading
labels
Jan 19, 2024
C-API working group issue: capi-workgroup/decisions#9 |
Just FYI, feature requests do not need version label :) |
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Jan 23, 2024
The new `PyList_GetItemRef` is similar to `PyList_GetItem`, but returns a strong reference instead of a borrowed reference. Additionally, if the passed "list" object is not a list, the function sets a `TypeError` instead of calling `PyErr_BadInternalCall()`.
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Jan 30, 2024
encukou
pushed a commit
that referenced
this issue
Feb 2, 2024
The new `PyList_GetItemRef` is similar to `PyList_GetItem`, but returns a strong reference instead of a borrowed reference. Additionally, if the passed "list" object is not a list, the function sets a `TypeError` instead of calling `PyErr_BadInternalCall()`.
Thank you! |
aisk
pushed a commit
to aisk/cpython
that referenced
this issue
Feb 11, 2024
The new `PyList_GetItemRef` is similar to `PyList_GetItem`, but returns a strong reference instead of a borrowed reference. Additionally, if the passed "list" object is not a list, the function sets a `TypeError` instead of calling `PyErr_BadInternalCall()`.
fsc-eriker
pushed a commit
to fsc-eriker/cpython
that referenced
this issue
Feb 14, 2024
The new `PyList_GetItemRef` is similar to `PyList_GetItem`, but returns a strong reference instead of a borrowed reference. Additionally, if the passed "list" object is not a list, the function sets a `TypeError` instead of calling `PyErr_BadInternalCall()`.
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Apr 3, 2024
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Apr 3, 2024
vstinner
added a commit
that referenced
this issue
Apr 3, 2024
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this issue
Apr 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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 proposedPyList_FetchItem
, but since thenPyDict_GetItemRef
and functions with similar signatures have been added.This proposes
PyList_GetItemRef
with the following signature: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. Iflist
is not a list instance, return NULL and set a TypeError.Linked PRs
PyList_GetItemRef
function #114504The text was updated successfully, but these errors were encountered: