summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-05-31 21:17:24 (GMT)
committerGitHub <noreply@github.com>2023-05-31 21:17:24 (GMT)
commitf87c6d189418850ac9c2e5f9cb08531cf004f704 (patch)
treea22acb20bd56df12a11800f800af702f0d52c816
parente7cb216339e8aa8d00f7f55f9e37864b1720ca0f (diff)
downloadcpython-f87c6d189418850ac9c2e5f9cb08531cf004f704.zip
cpython-f87c6d189418850ac9c2e5f9cb08531cf004f704.tar.gz
cpython-f87c6d189418850ac9c2e5f9cb08531cf004f704.tar.bz2
[3.12] gh-102304: Fix 2 New Stable ABI Functions (gh-104762) (gh-105123)
-rw-r--r--Include/object.h2
-rw-r--r--Lib/test/test_stable_abi_ctypes.py2
-rw-r--r--Misc/stable_abi.toml9
-rwxr-xr-xPC/python3dll.c2
4 files changed, 14 insertions, 1 deletions
diff --git a/Include/object.h b/Include/object.h
index 81aeb2d..c2fee85 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -590,7 +590,7 @@ you can count such references to the type object.)
extern Py_ssize_t _Py_RefTotal;
# define _Py_INC_REFTOTAL() _Py_RefTotal++
# define _Py_DEC_REFTOTAL() _Py_RefTotal--
-# elif !defined(Py_LIMITED_API) || Py_LIMITED_API+0 > 0x030C0000
+# elif !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030C0000
PyAPI_FUNC(void) _Py_IncRefTotal_DO_NOT_USE_THIS(void);
PyAPI_FUNC(void) _Py_DecRefTotal_DO_NOT_USE_THIS(void);
# define _Py_INC_REFTOTAL() _Py_IncRefTotal_DO_NOT_USE_THIS()
diff --git a/Lib/test/test_stable_abi_ctypes.py b/Lib/test/test_stable_abi_ctypes.py
index 4ca39d8..60ad360 100644
--- a/Lib/test/test_stable_abi_ctypes.py
+++ b/Lib/test/test_stable_abi_ctypes.py
@@ -918,6 +918,8 @@ if feature_macros['PY_HAVE_THREAD_NATIVE_ID']:
)
if feature_macros['Py_REF_DEBUG']:
SYMBOL_NAMES += (
+ '_Py_DecRefTotal_DO_NOT_USE_THIS',
+ '_Py_IncRefTotal_DO_NOT_USE_THIS',
'_Py_NegativeRefcount',
'_Py_RefTotal',
)
diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml
index 48299e9..1db9848 100644
--- a/Misc/stable_abi.toml
+++ b/Misc/stable_abi.toml
@@ -2406,3 +2406,12 @@
added = '3.12'
[const.Py_TPFLAGS_ITEMS_AT_END]
added = '3.12'
+
+[function._Py_IncRefTotal_DO_NOT_USE_THIS]
+ added = '3.12'
+ ifdef = 'Py_REF_DEBUG'
+ abi_only = true
+[function._Py_DecRefTotal_DO_NOT_USE_THIS]
+ added = '3.12'
+ ifdef = 'Py_REF_DEBUG'
+ abi_only = true
diff --git a/PC/python3dll.c b/PC/python3dll.c
index 7e848ab..f2c0d9d 100755
--- a/PC/python3dll.c
+++ b/PC/python3dll.c
@@ -18,7 +18,9 @@ EXPORT_FUNC(_Py_BuildValue_SizeT)
EXPORT_FUNC(_Py_CheckRecursiveCall)
EXPORT_FUNC(_Py_Dealloc)
EXPORT_FUNC(_Py_DecRef)
+EXPORT_FUNC(_Py_DecRefTotal_DO_NOT_USE_THIS)
EXPORT_FUNC(_Py_IncRef)
+EXPORT_FUNC(_Py_IncRefTotal_DO_NOT_USE_THIS)
EXPORT_FUNC(_Py_NegativeRefcount)
EXPORT_FUNC(_Py_VaBuildValue_SizeT)
EXPORT_FUNC(_PyArg_Parse_SizeT)