Skip to content

Commit 6aee7f5

Browse files
Addressed Comments
1 parent 8484c4b commit 6aee7f5

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

Doc/whatsnew/3.14.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,7 @@ New Features
417417
which has an ambiguous return value.
418418
(Contributed by Irit Katriel and Erlend Aasland in :gh:`105201`.)
419419

420-
* Modified the ``_PyUnicode_ClearInterned`` function to always delete all
421-
interned strings during a call to :c:func:`Py_Finalize`. This
420+
* :c:func:`Py_Finalize` now deletes all interned strings. This
422421
is backwards incompatible to any C-Extension that holds onto an interned
423422
string after a call to :c:func:`Py_Finalize` and is then reused after a
424423
call to :c:func:`Py_Initialize`. Any issues arising from this behavior will
Original file line numberDiff line numberDiff line change
@@ -1,20 +1 @@
1-
This updates the interned string deallocation function
2-
``_PyUnicode_ClearInterned`` to delete all interned strings during runtime
3-
finalization when calling ``Py_Finalize``, regardless of their reference
4-
count.
5-
6-
Worth noting that if an extension accidentally holds onto a interned string,
7-
even after calling Py_Finalize, it will result in use-after-free error,
8-
leaving the user to a potential vulnerabilities. That said, the history of
9-
how these interned strings are handled have been changing during throughout
10-
different versions.
11-
12-
For example, in Python 3.9 and older, interned strings were never deleted.
13-
Only special builds for Valgrind and Purity cleared them at exit. In Python
14-
3.10 and 3.11, interned strings are always deleted at exit. In Python 3.12,
15-
interned strings are deleted only if Python is built in debug mode: they
16-
are not deleted in release mode. In Python 3.13, interned strings will
17-
now be all deleted.
18-
19-
Given how the guarantees changed throughout different versions, it is not
20-
expected that users actively rely on this behavior for their extensions.
1+
:c:func:`Py_Finalize` now deletes all interned strings.

0 commit comments

Comments
 (0)