diff --git a/Doc/data/stable_abi.dat b/Doc/data/stable_abi.dat index c189c78238f40f..5bccd5edf586f4 100644 --- a/Doc/data/stable_abi.dat +++ b/Doc/data/stable_abi.dat @@ -840,6 +840,7 @@ function,Py_Initialize,3.2,, function,Py_InitializeEx,3.2,, function,Py_Is,3.10,, function,Py_IsFalse,3.10,, +function,Py_IsFinalizing,3.13,, function,Py_IsInitialized,3.2,, function,Py_IsNone,3.10,, function,Py_IsTrue,3.10,, diff --git a/Include/cpython/pylifecycle.h b/Include/cpython/pylifecycle.h index 11b280afa8435b..d425a233f71000 100644 --- a/Include/cpython/pylifecycle.h +++ b/Include/cpython/pylifecycle.h @@ -81,5 +81,3 @@ PyAPI_FUNC(PyStatus) Py_NewInterpreterFromConfig( typedef void (*atexit_datacallbackfunc)(void *); PyAPI_FUNC(int) PyUnstable_AtExit( PyInterpreterState *, atexit_datacallbackfunc, void *); - -PyAPI_FUNC(int) Py_IsFinalizing(void); diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index 34f32a5000e9d5..c1e2bc5e323358 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -60,6 +60,10 @@ PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); PyAPI_DATA(const unsigned long) Py_Version; #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030D0000 +PyAPI_FUNC(int) Py_IsFinalizing(void); +#endif + #ifndef Py_LIMITED_API # define Py_CPYTHON_PYLIFECYCLE_H # include "cpython/pylifecycle.h" diff --git a/Lib/test/test_stable_abi_ctypes.py b/Lib/test/test_stable_abi_ctypes.py index 94f817f8e1d159..4691687ed9d391 100644 --- a/Lib/test/test_stable_abi_ctypes.py +++ b/Lib/test/test_stable_abi_ctypes.py @@ -851,6 +851,7 @@ def test_windows_feature_macros(self): "Py_InitializeEx", "Py_Is", "Py_IsFalse", + "Py_IsFinalizing", "Py_IsInitialized", "Py_IsNone", "Py_IsTrue", diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml index 8df3f85e61eec6..469fd27b622344 100644 --- a/Misc/stable_abi.toml +++ b/Misc/stable_abi.toml @@ -2460,3 +2460,5 @@ added = '3.13' [function.PyMapping_HasKeyStringWithError] added = '3.13' +[function.Py_IsFinalizing] + added = '3.13' diff --git a/PC/python3dll.c b/PC/python3dll.c index 2c1cc8098ce856..785d6886f39f6d 100755 --- a/PC/python3dll.c +++ b/PC/python3dll.c @@ -69,6 +69,7 @@ EXPORT_FUNC(Py_Initialize) EXPORT_FUNC(Py_InitializeEx) EXPORT_FUNC(Py_Is) EXPORT_FUNC(Py_IsFalse) +EXPORT_FUNC(Py_IsFinalizing) EXPORT_FUNC(Py_IsInitialized) EXPORT_FUNC(Py_IsNone) EXPORT_FUNC(Py_IsTrue)