summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-06-21 19:21:47 (GMT)
committerGitHub <noreply@github.com>2024-06-21 19:21:47 (GMT)
commite748805f2a0f783723ef02809f86cd3d8fb8bf2e (patch)
treeb39671b4b4b4df9ddef3d9e50a8a3b484d7089ef
parentabdbf337d4641cf27d39fae206c2a08d27f6fcd9 (diff)
downloadcpython-e748805f2a0f783723ef02809f86cd3d8fb8bf2e.zip
cpython-e748805f2a0f783723ef02809f86cd3d8fb8bf2e.tar.gz
cpython-e748805f2a0f783723ef02809f86cd3d8fb8bf2e.tar.bz2
[3.13] gh-120838: Add a Note in the Docs About Expectations for Py_Finalize() (gh-120852)
(cherry picked from commit 03fa2df92707b543c304a426732214002f81d671, AKA gh-120839) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
-rw-r--r--Doc/c-api/init.rst13
1 files changed, 10 insertions, 3 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 58c7903..6b45413 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -396,9 +396,16 @@ Initializing and finalizing the interpreter
: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
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
- return value is ``0``. If there were errors during finalization
- (flushing buffered data), ``-1`` is returned.
+ time (without calling :c:func:`Py_Initialize` again first).
+
+ 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
might want to restart Python without having to restart the application itself.