-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Calling PyList_GetItemRef after PyList_New segfaults #121403
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
Comments
|
I think that we should update the documentation, @colesbury WDYT? |
Maybe the doc must only list functions which are safe to use: only PyList_SET_ITEM() is safe until the list is fully initialized. |
+1 |
Yeah, I think we should update the docs to make the restrictions more clear instead of changing the behavior of |
…init (pythongh-121626) (cherry picked from commit 2bac2b8) Co-authored-by: Donghee Na <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Crash report
What happened?
While working on Pillow, I came across the following issue: I'm getting a crash when calling
PyList_GetItemRef
immediately after callingPyList_New
since list item is initialized toNULL
.In the docs for
PyList_New
, we include the following note:Not sure if this includes calling
PyList_GetItemRef
.The problem is there on both builds, cause they both eventually try to call some variation of
Py_NewRef
/_Py_NewRefWithLock
.PyList_GetItem
does not crash and returnsNULL
.CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Output from running 'python -VV' on the command line:
Python 3.13.0b2+ (heads/3.13:7302855, Jun 21 2024, 10:05:10) [Clang 15.0.0 (clang-1500.3.9.4)]
Linked PRs
The text was updated successfully, but these errors were encountered: