Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
gh-144473: Add "steal" term to glossary; clarify "stealing" on error#144474
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -180,10 +180,11 @@ called with a non-bytes parameter. | ||
| .. c:function:: void PyBytes_Concat(PyObject **bytes, PyObject *newpart) | ||
| Create a new bytes object in *\*bytes* containing the contents of *newpart* | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. 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. | ||
| If the new object cannot be created, the old reference to *bytes* will still | ||
| be "stolen", the value of *\*bytes* will be set to ``NULL``, and | ||
| the appropriate exception will be set. | ||
| .. c:function:: void PyBytes_ConcatAndDel(PyObject **bytes, PyObject *newpart) | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -88,8 +88,10 @@ List Objects | ||||||
| ..note:: | ||||||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more.
Suggested change
| ||||||
| .. c:function:: void PyList_SET_ITEM(PyObject *list, Py_ssize_t i, PyObject *o) | ||||||
| @@ -103,7 +105,7 @@ List Objects | ||||||
| ..note:: | ||||||
| This macro ":term:`steals <steal>`" a reference to *item*, and, unlike | ||||||
| :c:func:`PyList_SetItem`, does *not* discard a reference to any item that | ||||||
| is being replaced; any reference in *list* at position *i* will be | ||||||
| leaked. | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1464,6 +1464,12 @@ Glossary | ||
| stdlib | ||
| An abbreviation of:term:`standard library`. | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. You may add something like: "The caller must not use that reference after the call". MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I added that to the | ||
| Generally, functions that "steal" an argument do so even if they fail. | ||
| See also:ref:`api-refcountdetails`. | ||
| strong reference | ||
| In Python's C API, a strong reference is a reference to an object | ||
| which is owned by the code holding the reference. The strong | ||
Uh oh!
There was an error while loading.Please reload this page.