gh-144473: Add "steal" term to glossary; clarify "stealing" on error#144474
Open
encukou wants to merge 1 commit intopython:mainfrom
Open
gh-144473: Add "steal" term to glossary; clarify "stealing" on error#144474encukou wants to merge 1 commit intopython:mainfrom
encukou wants to merge 1 commit intopython:mainfrom
Conversation
With one exception, all "stealing" functions also steal on error, but it makes sense to note this in each case.
vstinner
reviewed
Feb 4, 2026
|
|
||
| steal | ||
| In Python's C API, "*stealing*" an argument means that ownership of the | ||
| argument is transferred to the called function. |
Member
There was a problem hiding this comment.
You may add something like: "The caller must not use that reference after the call".
Member
Author
There was a problem hiding this comment.
I added that to the api-refcountdetails that's linked below. Do you think it needs to be here as well?
Member
There was a problem hiding this comment.
Do you think it needs to be here as well?
Yes, IMO it's worth it to repeat it here.
| This function ":term:`steals <steal>`" a reference to *item*, | ||
| even on error. | ||
| On success, it discards a reference to an item already in the list | ||
| at the affected position (unless it was NULL). |
Member
There was a problem hiding this comment.
NULL should be in a code block:
Suggested change
| at the affected position (unless it was NULL). | |
| at the affected position (unless it was ``NULL``). |
| created, the old reference to *bytes* will still be discarded and the value | ||
| of *\*bytes* will be set to ``NULL``; the appropriate exception will be set. | ||
| appended to *bytes*; the caller will own the new reference. | ||
| The reference to the old value of *bytes* will be ":term:`stolen <steal>`". |
Member
There was a problem hiding this comment.
I'm not a huge fan of putting "steal(s)" in quotations. If the user is confused about the term, then they can just click it to go to the glossary. Otherwise, the user knows the term, so it shouldn't be in scare quotes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📚 Documentation preview 📚: https://cpython-previews--144474.org.readthedocs.build/