mirror of
https://github.com/python/cpython.git
synced 2025-08-19 00:00:48 +00:00
[3.12] gh-98154: Clarify Usage of "Reference Count" In the Docs (gh-107552) (#107752)
* gh-98154: Clarify Usage of "Reference Count" In the Docs (gh-107552)
PEP 683 (immortal objects) revealed some ways in which the Python documentation has been unnecessarily coupled to the implementation details of reference counts. In the end users should focus on reference ownership, including taking references and releasing them, rather than on how many reference counts an object has.
This change updates the documentation to reflect that perspective. It also updates the docs relative to immortal objects in a handful of places.
(cherry picked from commit 5dc825d504
)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* Fix a typo.
---------
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
parent
e5582bdbcf
commit
aa2ecef22a
15 changed files with 162 additions and 90 deletions
|
@ -770,6 +770,15 @@ always available.
|
|||
higher than you might expect, because it includes the (temporary) reference as
|
||||
an argument to :func:`getrefcount`.
|
||||
|
||||
Note that the returned value may not actually reflect how many
|
||||
references to the object are actually held. For example, some
|
||||
objects are "immortal" and have a very high refcount that does not
|
||||
reflect the actual number of references. Consequently, do not rely
|
||||
on the returned value to be accurate, other than a value of 0 or 1.
|
||||
|
||||
.. versionchanged:: 3.12
|
||||
Immortal objects have very large refcounts that do not match
|
||||
the actual number of references to the object.
|
||||
|
||||
.. function:: getrecursionlimit()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue