8000 gh-98154: Clarify Usage of "Reference Count" In the Docs by ericsnowcurrently · Pull Request #107552 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-98154: Clarify Usage of "Reference Count" In the Docs #107552

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

Merged
merged 15 commits into from
Aug 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update the unicode doc.
  • Loading branch information
ericsnowcurrently committed Aug 1, 2023
commit 0109c1207d72f36dba39246ac70f185e741a73ee
12 changes: 6 additions & 6 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ APIs:

Copy an instance of a Unicode subtype to a new true Unicode object if
necessary. If *obj* is already a true Unicode object (not a subtype),
return the reference with incremented refcount.
return a new :term:`strong reference` to the object.

Objects other than Unicode or its subtypes will cause a :exc:`TypeError`.

Expand Down Expand Up @@ -1438,11 +1438,11 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
Intern the argument *\*string* in place. The argument must be the address of a
pointer variable pointing to a Python Unicode string object. If there is an
existing interned string that is the same as *\*string*, it sets *\*string* to
it (decrementing the reference count of the old string object and incrementing
the reference count of the interned string object), otherwise it leaves
*\*string* alone and interns it (incrementing its reference count).
(Clarification: even though there is a lot of talk about reference counts, think
of this function as reference-count-neutral; you own the object after the call
it (releasing the reference to the old string object and creating a new
:term:`strong reference` to the interned string object), otherwise it leaves
*\*string* alone and interns it (creating a new :term:`strong reference`).
(Clarification: even though there is a lot of talk about references, think
of this function as reference-neutral; you own the object after the call
if and only if you owned it before the call.)


Expand Down
0