-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-121403: Add notes for PyList_GetXXX APIs about the need for init #121626
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
Conversation
I am not sure if we have to add notes to all list-related APIs, but for me, this note looks more straightforward from the user side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to only add a note to PyList_New() instead.
Yeah, I was going to suggest the same thing. |
Victor, if you are thinking about the comment that you wrote before. #121403 (comment) |
I suggest to say that only PyList_SET_ITEM() is safe to call before the list is fully initialized. |
|
Doc/c-api/list.rst
Outdated
:c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before | ||
the list is fully initialized. | ||
- :c:func:`PyList_SetItem()` | ||
- :c:func:`PyList_SET_ITEM()` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list is not rendered properly. Maybe just write: "The following ...: PyList_SetItem and PyList_SET_ITEM."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Waiting @colesbury, who is the best English speaker in this place :) |
Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…init (pythongh-121626) (cherry picked from commit 2bac2b8) Co-authored-by: Donghee Na <[email protected]>
GH-121827 is a backport of this pull request to the 3.13 branch. |
:c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before | ||
the list is fully initialized: :c:func:`PyList_SetItem()` and :c:func:`PyList_SET_ITEM()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for missing this PR while it was still open. I don't think this makes it clear enough that these are the only APIs that can be used before a list is fully initialized. Maybe something like this would be better?
:c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before | |
the list is fully initialized: :c:func:`PyList_SetItem()` and :c:func:`PyList_SET_ITEM()`. | |
:c:func:`PyList_SET_ITEM()`. The following APIs are the only safe APIs to use before | |
the list is fully initialized: :c:func:`PyList_SetItem()` and :c:func:`PyList_SET_ITEM()`. |
📚 Documentation preview 📚: https://cpython-previews--121626.org.readthedocs.build/