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.
This commit is contained in:
Eric Snow 2023-08-07 15:40:59 -06:00 committed by GitHub
parent 0191af97a6
commit 5dc825d504
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 162 additions and 90 deletions

View file

@ -546,7 +546,7 @@ state:
.. note::
Unlike other functions that steal references, ``PyModule_AddObject()``
only decrements the reference count of *value* **on success**.
only releases the reference to *value* **on success**.
This means that its return value must be checked, and calling code must
:c:func:`Py_XDECREF` *value* manually on error.