mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
[3.12] gh-120838: Add a Note in the Docs About Expectations for Py_Finalize() (gh-120853)
(cherry picked from commit 03fa2df927
, AKA gh-120839)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
parent
9bbb91c066
commit
a57d917a48
1 changed files with 10 additions and 3 deletions
|
@ -388,9 +388,16 @@ Initializing and finalizing the interpreter
|
||||||
:c:func:`Py_NewInterpreter` below) that were created and not yet destroyed since
|
:c:func:`Py_NewInterpreter` below) that were created and not yet destroyed since
|
||||||
the last call to :c:func:`Py_Initialize`. Ideally, this frees all memory
|
the last call to :c:func:`Py_Initialize`. Ideally, this frees all memory
|
||||||
allocated by the Python interpreter. This is a no-op when called for a second
|
allocated by the Python interpreter. This is a no-op when called for a second
|
||||||
time (without calling :c:func:`Py_Initialize` again first). Normally the
|
time (without calling :c:func:`Py_Initialize` again first).
|
||||||
return value is ``0``. If there were errors during finalization
|
|
||||||
(flushing buffered data), ``-1`` is returned.
|
Since this is the reverse of :c:func:`Py_Initialize`, it should be called
|
||||||
|
in the same thread with the same interpreter active. That means
|
||||||
|
the main thread and the main interpreter.
|
||||||
|
This should never be called while :c:func:`Py_RunMain` is running.
|
||||||
|
|
||||||
|
Normally the return value is ``0``.
|
||||||
|
If there were errors during finalization (flushing buffered data),
|
||||||
|
``-1`` is returned.
|
||||||
|
|
||||||
This function is provided for a number of reasons. An embedding application
|
This function is provided for a number of reasons. An embedding application
|
||||||
might want to restart Python without having to restart the application itself.
|
might want to restart Python without having to restart the application itself.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue