diff options
author | Peter Bierma <zintensitydev@gmail.com> | 2024-12-11 11:14:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-11 11:14:04 (GMT) |
commit | d5d84c3f13fe7fe591b375c41979d362bc11957a (patch) | |
tree | f5256d76f43516d757ab68ff64eeb05851644969 /Doc | |
parent | 2cdeb61b57e638ae46a04386330a12abe9cddf2c (diff) | |
download | cpython-d5d84c3f13fe7fe591b375c41979d362bc11957a.zip cpython-d5d84c3f13fe7fe591b375c41979d362bc11957a.tar.gz cpython-d5d84c3f13fe7fe591b375c41979d362bc11957a.tar.bz2 |
gh-127791: Fix, document, and test `PyUnstable_AtExit` (#127793)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/init.rst | 9 | ||||
-rw-r--r-- | Doc/c-api/sys.rst | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index ba1c285..dd63dd0 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -567,6 +567,15 @@ Initializing and finalizing the interpreter customized Python that always runs in isolated mode using :c:func:`Py_RunMain`. +.. c:function:: int PyUnstable_AtExit(PyInterpreterState *interp, void (*func)(void *), void *data) + + Register an :mod:`atexit` callback for the target interpreter *interp*. + This is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and + data pointer for the callback. + + The :term:`GIL` must be held for *interp*. + + .. versionadded:: 3.13 Process-wide parameters ======================= diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst index d6fca1a..c688afd 100644 --- a/Doc/c-api/sys.rst +++ b/Doc/c-api/sys.rst @@ -426,3 +426,7 @@ Process Control function registered last is called first. Each cleanup function will be called at most once. Since Python's internal finalization will have completed before the cleanup function, no Python APIs should be called by *func*. + + .. seealso:: + + :c:func:`PyUnstable_AtExit` for passing a ``void *data`` argument. |