Skip to content

Commit 1f0f0ce

Browse files
committed
pythongh-110481, doc: Add "immortal" term to the glossary
1 parent 7680da4 commit 1f0f0ce

File tree

8 files changed

+32
-21
lines changed

8 files changed

+32
-21
lines changed

Doc/c-api/bool.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ are available, however.
2626
.. c:var:: PyObject* Py_False
2727
2828
The Python ``False`` object. This object has no methods and is
29-
`immortal <https://peps.python.org/pep-0683/>`_.
29+
:term:`immortal`.
3030
31-
.. versionchanged:: 3.12
32-
:c:data:`Py_False` is immortal.
31+
.. versionchanged:: 3.12
32+
:c:data:`Py_False` is :term:`immortal`.
3333
3434
3535
.. c:var:: PyObject* Py_True
3636
3737
The Python ``True`` object. This object has no methods and is
38-
`immortal <https://peps.python.org/pep-0683/>`_.
38+
:term:`immortal`.
3939
40-
.. versionchanged:: 3.12
41-
:c:data:`Py_True` is immortal.
40+
.. versionchanged:: 3.12
41+
:c:data:`Py_True` is :term:`immortal`.
4242
4343
4444
.. c:macro:: Py_RETURN_FALSE

Doc/c-api/init.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ otherwise immutable (e.g. ``None``, ``(1, 5)``) can't normally be shared
14851485
because of the refcount. One simple but less-efficient approach around
14861486
this is to use a global lock around all use of some state (or object).
14871487
Alternately, effectively immutable objects (like integers or strings)
1488-
can be made safe in spite of their refcounts by making them "immortal".
1488+
can be made safe in spite of their refcounts by making them :term:`immortal`.
14891489
In fact, this has been done for the builtin singletons, small integers,
14901490
and a number of other builtin objects.
14911491

Doc/c-api/init_config.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ PyConfig
11701170
11711171
.. c:member:: int show_ref_count
11721172
1173-
Show total reference count at exit (excluding immortal objects)?
1173+
Show total reference count at exit (excluding :term:`immortal` objects)?
11741174
11751175
Set to ``1`` by :option:`-X showrefcount <-X>` command line option.
11761176

Doc/c-api/none.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ same reason.
1616
.. c:var:: PyObject* Py_None
1717
1818
The Python ``None`` object, denoting lack of value. This object has no methods
19-
and is `immortal <https://peps.python.org/pep-0683/>`_.
19+
and is :term:`immortal`.
2020

21-
.. versionchanged:: 3.12
22-
:c:data:`Py_None` is immortal.
21+
.. versionchanged:: 3.12
22+
:c:data:`Py_None` is :term:`immortal`.
2323

2424
.. c:macro:: Py_RETURN_NONE
2525

Doc/c-api/refcounting.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ of Python objects.
1717
1818
Note that the returned value may not actually reflect how many
1919
references to the object are actually held. For example, some
20-
objects are "immortal" and have a very high refcount that does not
20+
objects are :term:`immortal` and have a very high refcount that does not
2121
reflect the actual number of references. Consequently, do not rely
2222
on the returned value to be accurate, other than a value of 0 or 1.
2323
@@ -34,9 +34,7 @@ of Python objects.
3434
3535
Set the object *o* reference counter to *refcnt*.
3636
37-
Note that this function has no effect on
38-
`immortal <https://peps.python.org/pep-0683/>`_
39-
objects.
37+
This function has no effect on :term:`immortal` objects.
4038
4139
.. versionadded:: 3.9
4240
@@ -49,6 +47,8 @@ of Python objects.
4947
Indicate taking a new :term:`strong reference` to object *o*,
5048
indicating it is in use and should not be destroyed.
5149
50+
This function has no effect on :term:`immortal` objects.
51+
5252
This function is usually used to convert a :term:`borrowed reference` to a
5353
:term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be
5454
used to create a new :term:`strong reference`.
@@ -113,6 +113,8 @@ of Python objects.
113113
Release a :term:`strong reference` to object *o*, indicating the
114114
reference is no longer used.
115115
116+
This function has no effect on :term:`immortal` objects.
117+
116118
Once the last :term:`strong reference` is released
117119
(i.e. the object's reference count reaches 0),
118120
the object's type's deallocation

Doc/c-api/slice.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ Ellipsis Object
119119
.. c:var:: PyObject *Py_Ellipsis
120120
121121
The Python ``Ellipsis`` object. This object has no methods. Like
122-
:c:data:`Py_None`, it is an `immortal <https://peps.python.org/pep-0683/>`_.
123-
singleton object.
122+
:c:data:`Py_None`, it is an :term:`immortal` singleton object.
124123
125124
.. versionchanged:: 3.12
126125
:c:data:`Py_Ellipsis` is immortal.

Doc/glossary.rst

+11-1
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,16 @@ Glossary
579579
:ref:`idle` is a basic editor and interpreter environment
580580
which ships with the standard distribution of Python.
581581

582+
immortal
583+
If an object is immortal, its reference count is never modified, and
584+
therefore the objects is never deallocated.
585+
586+
Built-in strings and singletons are immortal objects. For example,
587+
:const:`True` and :const:`None` singletons are immmortal.
588+
589+
See `PEP 683 – Immortal Objects, Using a Fixed Refcount
590+
<https://peps.python.org/pep-0683/>`_ for more information.
591+
582592
immutable
583593
An object with a fixed value. Immutable objects include numbers, strings and
584594
tuples. Such an object cannot be altered. A new object has to
@@ -1056,7 +1066,7 @@ Glossary
10561066
reference count
10571067
The number of references to an object. When the reference count of an
10581068
object drops to zero, it is deallocated. Some objects are
1059-
"immortal" and have reference counts that are never modified, and
1069+
:term:`immortal` and have reference counts that are never modified, and
10601070
therefore the objects are never deallocated. Reference counting is
10611071
generally not visible to Python code, but it is a key element of the
10621072
:term:`CPython` implementation. Programmers can call the

Doc/library/sys.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ always available.
831831

832832
Note that the returned value may not actually reflect how many
833833
references to the object are actually held. For example, some
834-
objects are "immortal" and have a very high refcount that does not
834+
objects are :term:`immortal` and have a very high refcount that does not
835835
reflect the actual number of references. Consequently, do not rely
836836
on the returned value to be accurate, other than a value of 0 or 1.
837837

@@ -1182,8 +1182,8 @@ always available.
11821182
names used in Python programs are automatically interned, and the dictionaries
11831183
used to hold module, class or instance attributes have interned keys.
11841184

1185-
Interned strings are not immortal; you must keep a reference to the return
1186-
value of :func:`intern` around to benefit from it.
1185+
Interned strings are not :term:`immortal`; you must keep a reference to the
1186+
return value of :func:`intern` around to benefit from it.
11871187

11881188

11891189
.. function:: is_finalizing()

0 commit comments

Comments
 (0)