Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1750,9 +1750,12 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
:c:expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not,
then -- as with any other error -- the argument is left unchanged.

Note that interned strings are not immortal.
Strings interned by this function are not :term:`immortal`.
You must keep a reference to the result to benefit from interning.

.. note::
On the free-threaded build, all interned strings are :term:`immortal`.
This may change in the future.

.. c:function:: PyObject* PyUnicode_InternFromString(const char *str)

Expand Down
4 changes: 2 additions & 2 deletions Doc/howto/free-threading-python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ This section describes known limitations of the free-threaded CPython build.
Immortalization
---------------

In the free-threaded build, some objects are :term:`immortal`.
On the free-threaded build, more objects are made immortal.
Immortal objects are not deallocated and have reference counts that are
never modified. This is done to avoid reference count contention that would
prevent efficient multi-threaded scaling.

As of the 3.14 release, immortalization is limited to:
As of the 3.14 release, this additional immortalization is limited to:

* Code constants: numeric literals, string literals, and tuple literals
composed of other constants.
Expand Down
3 changes: 3 additions & 0 deletions Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,9 @@ always available. Unless explicitly noted otherwise, all variables are read-only
Interned strings are not :term:`immortal`; you must keep a reference to the
return value of :func:`intern` around to benefit from it.

.. note::
On the free-threaded build, all interned strings are :term:`immortal`.
This may change in the future.

.. function:: _is_gil_enabled()

Expand Down
Loading