From c9316a5856b823d589f8a2f79bff06d86dc0166a Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 22 May 2023 16:14:07 -0600 Subject: [PATCH 1/6] Fix the ABI version. --- Include/object.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/object.h b/Include/object.h index 81aeb2d8bd5a69..c2fee85a2c38f6 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() From 247f7bb0359e9c35992e3061d119bd6837f61d56 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 22 May 2023 16:14:31 -0600 Subject: [PATCH 2/6] Note the new stable-ABI functions. --- Misc/stable_abi.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml index 48299e9b35ff97..508b1846f9fbef 100644 --- a/Misc/stable_abi.toml +++ b/Misc/stable_abi.toml @@ -2406,3 +2406,8 @@ added = '3.12' [const.Py_TPFLAGS_ITEMS_AT_END] added = '3.12' + +[function._Py_IncRefTotal_DO_NOT_USE_THIS] + added = '3.12' +[function._Py_DecRefTotal_DO_NOT_USE_THIS] + added = '3.12' From 9f85962ed30de91079eef2bf9581d98d5586edda Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 22 May 2023 16:27:53 -0600 Subject: [PATCH 3/6] Update Misc/stable_abi.toml Co-authored-by: T. Wouters --- Misc/stable_abi.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml index 508b1846f9fbef..617d18488efedc 100644 --- a/Misc/stable_abi.toml +++ b/Misc/stable_abi.toml @@ -2409,5 +2409,6 @@ [function._Py_IncRefTotal_DO_NOT_USE_THIS] added = '3.12' + abi_only = true [function._Py_DecRefTotal_DO_NOT_USE_THIS] added = '3.12' From 340ed37821f8cbdd0c3b66a59981fda4a30b6abf Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 22 May 2023 16:27:59 -0600 Subject: [PATCH 4/6] Update Misc/stable_abi.toml Co-authored-by: T. Wouters --- Misc/stable_abi.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml index 617d18488efedc..8f5b9140f1ecf9 100644 --- a/Misc/stable_abi.toml +++ b/Misc/stable_abi.toml @@ -2412,3 +2412,4 @@ abi_only = true [function._Py_DecRefTotal_DO_NOT_USE_THIS] added = '3.12' + abi_only = true From a0e7b362b6aa856725f2fc35bad2ae6f7b54592c Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 22 May 2023 16:32:18 -0600 Subject: [PATCH 5/6] Add missing ifdef. --- Misc/stable_abi.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml index 8f5b9140f1ecf9..1db98483f09f77 100644 --- a/Misc/stable_abi.toml +++ b/Misc/stable_abi.toml @@ -2409,7 +2409,9 @@ [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 From 4987af7b8a6e38b186ae2f8e6ce58558b8c6bfc4 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Tue, 30 May 2023 16:14:22 -0600 Subject: [PATCH 6/6] Regen limited API artifacts. --- Lib/test/test_stable_abi_ctypes.py | 2 ++ PC/python3dll.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Lib/test/test_stable_abi_ctypes.py b/Lib/test/test_stable_abi_ctypes.py index 4ca39d85e5460c..60ad3603ae9223 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/PC/python3dll.c b/PC/python3dll.c index 7e848abccfd1fa..f2c0d9dee883d9 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)