[Python-checkins] gh-102304: Fix 2 New Stable ABI Functions (gh-104762)

ericsnowcurrently webhook-mailer at python.org
Tue May 30 18:40:15 EDT 2023


https://github.com/python/cpython/commit/26e7bbf66e93ee7c94b6e007ec7b2d769c2ced92
commit: 26e7bbf66e93ee7c94b6e007ec7b2d769c2ced92
branch: main
author: Eric Snow <ericsnowcurrently at gmail.com>
committer: ericsnowcurrently <ericsnowcurrently at gmail.com>
date: 2023-05-30T22:40:07Z
summary:

gh-102304: Fix 2 New Stable ABI Functions (gh-104762)

files:
M Include/object.h
M Lib/test/test_stable_abi_ctypes.py
M Misc/stable_abi.toml
M PC/python3dll.c

diff --git a/Include/object.h b/Include/object.h
index c4fe2f83ef62..c2fee85a2c38 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 > 0x030D0000
+#  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 4ca39d85e546..60ad3603ae92 100644
--- a/Lib/test/test_stable_abi_ctypes.py
+++ b/Lib/test/test_stable_abi_ctypes.py
@@ -918,6 +918,8 @@ def test_windows_feature_macros(self):
     )
 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 48299e9b35ff..1db98483f09f 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 7e848abccfd1..f2c0d9dee883 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)



More information about the Python-checkins mailing list