]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-146063: Add PyObject_CallFinalizerFromDealloc() to the limited C API (#146172)
authorVictor Stinner <vstinner@python.org>
Mon, 4 May 2026 13:37:45 +0000 (15:37 +0200)
committerGitHub <noreply@github.com>
Mon, 4 May 2026 13:37:45 +0000 (15:37 +0200)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Doc/data/stable_abi.dat
Doc/whatsnew/3.15.rst
Include/cpython/object.h
Include/object.h
Lib/test/test_stable_abi_ctypes.py
Misc/NEWS.d/next/C_API/2026-03-19-15-28-14.gh-issue-146063.Sc-1RU.rst [new file with mode: 0644]
Misc/stable_abi.toml
PC/python3dll.c

index 4ae5e999f0bf21db3f8caa04590467c168617e18..2ef2bccf2b7728c4bb4f0ddb011fc9353c0a5900 100644 (file)
@@ -565,6 +565,7 @@ func,PyObject_ASCII,3.2,,
 func,PyObject_AsFileDescriptor,3.2,,
 func,PyObject_Bytes,3.2,,
 func,PyObject_Call,3.2,,
+func,PyObject_CallFinalizerFromDealloc,3.15,,
 func,PyObject_CallFunction,3.2,,
 func,PyObject_CallFunctionObjArgs,3.2,,
 func,PyObject_CallMethod,3.2,,
index 2a493010ece0fdbf51238a5b890cb296d2f37525..a8a779fefa0c851063d4cecca22d213def2f9f1e 100644 (file)
@@ -2050,6 +2050,10 @@ New features
 
   (Contributed by Victor Stinner in :gh:`141510`.)
 
+* Add :c:func:`PyObject_CallFinalizerFromDealloc` function to the limited C
+  API.
+  (Contributed by Victor Stinner in :gh:`146063`.)
+
 * Add :c:func:`PySys_GetAttr`, :c:func:`PySys_GetAttrString`,
   :c:func:`PySys_GetOptionalAttr`, and :c:func:`PySys_GetOptionalAttrString`
   functions as replacements for :c:func:`PySys_GetObject`.
index 0b50d2a9dd8698faaa1c619966c46fbbdf1fbcd6..d0b3d0cb14de3df3721e03fac52939c4e27071a8 100644 (file)
@@ -307,7 +307,6 @@ Py_DEPRECATED(3.15) PyAPI_FUNC(PyObject*) _PyObject_GetAttrId(PyObject *, _Py_Id
 
 PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *);
 PyAPI_FUNC(void) PyObject_CallFinalizer(PyObject *);
-PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *);
 
 PyAPI_FUNC(void) PyUnstable_Object_ClearWeakRefsNoCallbacks(PyObject *);
 
index d51132be1a6656387aa8f8a08c80b24a05e50a48..043be0260b1aec4ade77dfb06ffcba1f4d2eb18a 100644 (file)
@@ -782,6 +782,7 @@ PyAPI_FUNC(int) PyType_Freeze(PyTypeObject *type);
 #endif
 
 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= _Py_PACK_VERSION(3, 15)
+PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *);
 PyAPI_FUNC(PyObject *) PyType_GetModuleByToken(PyTypeObject *type,
                                                const void *token);
 PyAPI_FUNC(void *) PyObject_GetTypeData_DuringGC(PyObject *obj,
index ed0868e0017fcea6018f77a2395a1e89a1b8312f..5dae5dfccac5d323052d619b90b0e897e87ad707 100644 (file)
@@ -552,6 +552,7 @@ SYMBOL_NAMES = (
     "PyObject_AsWriteBuffer",
     "PyObject_Bytes",
     "PyObject_Call",
+    "PyObject_CallFinalizerFromDealloc",
     "PyObject_CallFunction",
     "PyObject_CallFunctionObjArgs",
     "PyObject_CallMethod",
diff --git a/Misc/NEWS.d/next/C_API/2026-03-19-15-28-14.gh-issue-146063.Sc-1RU.rst b/Misc/NEWS.d/next/C_API/2026-03-19-15-28-14.gh-issue-146063.Sc-1RU.rst
new file mode 100644 (file)
index 0000000..e20e11a
--- /dev/null
@@ -0,0 +1,2 @@
+Add :c:func:`PyObject_CallFinalizerFromDealloc` function to the limited C API.
+Patch by Victor Stinner.
index 101737a27829c9c5f6e34240488af74c7564e868..e6c63227d20446a2da5acb9c8c073493bbef60de 100644 (file)
     added = '3.15'
 
 # PEP 757 import/export API.
-
 [function.PyLong_GetNativeLayout]
     added = '3.15'
 [function.PyLong_Export]
     # Note: The `_reserved` member of this struct is for interal use only.
     # (The definition of 'full-abi' was clarified when this entry was added.)
     struct_abi_kind = 'full-abi'
+
+[function.PyObject_CallFinalizerFromDealloc]
+    added = '3.15'
index abbe35c342c13e14138cecb321973e7749815e6d..6b9ef0a4164c168768f8c0833fb7d9d258c85af4 100755 (executable)
@@ -489,6 +489,7 @@ EXPORT_FUNC(PyObject_AsReadBuffer)
 EXPORT_FUNC(PyObject_AsWriteBuffer)
 EXPORT_FUNC(PyObject_Bytes)
 EXPORT_FUNC(PyObject_Call)
+EXPORT_FUNC(PyObject_CallFinalizerFromDealloc)
 EXPORT_FUNC(PyObject_CallFunction)
 EXPORT_FUNC(PyObject_CallFunctionObjArgs)
 EXPORT_FUNC(PyObject_CallMethod)