8000 gh-113190: Reenable non-debug interned string cleanup by eduardo-elizondo · Pull Request #113601 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-113190: Reenable non-debug interned string cleanup #113601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Lint docs v3
  • Loading branch information
eduardo-elizondo committed Jan 15, 2024
commit dd1e8b4c72d5a42ddfef783879b867443458832e
5 changes: 3 additions & 2 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,12 @@ Initializing and finalizing the interpreter
time (without calling :c:func:`Py_Initialize` again first). Normally the
return value is ``0``. If there were errors during finalization
(flushing buffered data), ``-1`` is returned.

Note that Python will do a best effort at freeing all memory allocated by the Python
interpreter. Therefore, any C-Extension should make sure to correctly clean up all
of the preveiously allocated PyObjects before using them in subsequent calls to
`Py_Initialize`. Otherwise it introduces vulnerabilities and incorrect behavior.
:c:func:`Py_Initialize`. Otherwise it could introduce vulnerabilities and incorrect
behavior.

This function is provided for a number of reasons. An embedding application
might want to restart Python without having to restart the application itself.
Expand Down
6 changes: 3 additions & 3 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1366,10 +1366,10 @@ New Features
* Modified :c:func:`_PyUnicode_ClearInterned` function to always delete all
interned strings during a call to :c:func:`Py_Finalize`. This makes all
is backwards incompatible to any C-Extension that holds onto an interned
string after a call to c:func:`Py_Finalize` and is then reused after a
call to c:func:`Py_Initialize`. Any issues arising from this behavior will
string after a call to :c:func:`Py_Finalize` and is then reused after a
call to :c:func:`Py_Initialize`. Any issues arising from this behavior will
normally result in crashes during the exectuion of the subsequent call to
c:func:`Py_Initatilize` from accessing uninitialized memory. To fix, use
:c:func:`Py_Initatilize` from accessing uninitialized memory. To fix, use
an address sanitizer (i.e. ASAN) to identify any use-after-free coming from
an interned string and deallocate it during module shutdown.
(Contribued by Eddie Elizondo in :gh:`113601`.)
Expand Down
0