]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-37340: Remove PyMethod_ClearFreeList() and PyCFunction_ClearFreeList() (GH-17284)
authorVictor Stinner <vstinner@python.org>
Wed, 20 Nov 2019 11:59:12 +0000 (12:59 +0100)
committerGitHub <noreply@github.com>
Wed, 20 Nov 2019 11:59:12 +0000 (12:59 +0100)
Remove PyMethod_ClearFreeList() and PyCFunction_ClearFreeList()
functions: the free lists of bound method objects have been removed.

Remove also _PyMethod_Fini() and _PyCFunction_Fini() functions.

Doc/whatsnew/3.9.rst
Include/classobject.h
Include/internal/pycore_pylifecycle.h
Include/methodobject.h
Misc/NEWS.d/next/C API/2019-11-20-11-08-06.bpo-37340.JBQJMS.rst [new file with mode: 0644]
Modules/gcmodule.c
Objects/classobject.c
Objects/methodobject.c
Python/pylifecycle.c

index 542a031960013d3ef6ddae8fb7fd84a7f4fcf2b3..281173edb895b3e6944f96ad81fd16f86a0e1808 100644 (file)
@@ -217,6 +217,7 @@ Build and C API Changes
   ``PyThreadState.recursion_depth`` field. Remove ``_Py_CheckRecursionLimit``
   from the stable ABI.
   (Contributed by Victor Stinner in :issue:`38644`.)
+
 * Add a new public :c:func:`PyObject_CallNoArgs` function to the C API, which
   calls a callable Python object without any arguments. It is the most efficient
   way to call a callable Python object without any argument.
@@ -230,6 +231,10 @@ Build and C API Changes
   ``pyfpe.h`` from ``Py_LIMITED_API`` (stable API).
   (Contributed by Victor Stinner in :issue:`38835`.)
 
+* Remove ``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()``
+  functions: the free lists of bound method objects have been removed.
+  (Contributed by Inada Naoki and Victor Stinner in :issue:`37340`.)
+
 
 Deprecated
 ==========
index c83303c390055380d1777c6233b90f36200c438c..840431a127691b3d73a9e87fbe7753cb98ee0f88 100644 (file)
@@ -33,8 +33,6 @@ PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
 #define PyMethod_GET_SELF(meth) \
         (((PyMethodObject *)meth) -> im_self)
 
-PyAPI_FUNC(int) PyMethod_ClearFreeList(void);
-
 typedef struct {
     PyObject_HEAD
     PyObject *func;
index b8d5e361b3c738803deb0b14c7204cc094d1558a..c837bcdbc03cc9d9b78213ddb5b3bbcd82107134 100644 (file)
@@ -59,9 +59,7 @@ extern PyStatus _PyGC_Init(PyThreadState *tstate);
 
 /* Various internal finalizers */
 
-extern void _PyMethod_Fini(void);
 extern void _PyFrame_Fini(void);
-extern void _PyCFunction_Fini(void);
 extern void _PyDict_Fini(void);
 extern void _PyTuple_Fini(void);
 extern void _PyList_Fini(void);
index 3bccf5a3f60d3ec8c32b6ce2ed6433c968d993ba..a15d05f89917e961c35c6c5c74f040d38e40e0f7 100644 (file)
@@ -97,8 +97,6 @@ typedef struct {
 } PyCFunctionObject;
 #endif
 
-PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/Misc/NEWS.d/next/C API/2019-11-20-11-08-06.bpo-37340.JBQJMS.rst b/Misc/NEWS.d/next/C API/2019-11-20-11-08-06.bpo-37340.JBQJMS.rst
new file mode 100644 (file)
index 0000000..8ffa4eb
--- /dev/null
@@ -0,0 +1,2 @@
+Remove ``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()``
+functions: the free lists of bound method objects have been removed.
index 967bbe9c0d45d044fdee8f560ac7510ab7375117..d232179a11ce4d7044670267b587e5e56de4706c 100644 (file)
@@ -1029,9 +1029,7 @@ delete_garbage(PyThreadState *tstate, GCState *gcstate,
 static void
 clear_freelists(void)
 {
-    (void)PyMethod_ClearFreeList();
     (void)PyFrame_ClearFreeList();
-    (void)PyCFunction_ClearFreeList();
     (void)PyTuple_ClearFreeList();
     (void)PyUnicode_ClearFreeList();
     (void)PyFloat_ClearFreeList();
index d3fc726415406d948c4cdf76b4bfc651ee3b43e6..db53f04862cd6bc265eeedc7622478549eac970c 100644 (file)
@@ -371,20 +371,6 @@ PyTypeObject PyMethod_Type = {
     method_new,                                 /* tp_new */
 };
 
-/* Clear out the free list */
-
-int
-PyMethod_ClearFreeList(void)
-{
-    return 0;
-}
-
-void
-_PyMethod_Fini(void)
-{
-    (void)PyMethod_ClearFreeList();
-}
-
 /* ------------------------------------------------------------------------
  * instance method
  */
index 8f752c610ce4b97c2afdd62a8e731e19b88330cf..6a37238d86d8d42f6ec52fdb1fdc6469e854e192 100644 (file)
@@ -313,21 +313,6 @@ PyTypeObject PyCFunction_Type = {
     0,                                          /* tp_dict */
 };
 
-/* Clear out the free list */
-
-int
-PyCFunction_ClearFreeList(void)
-{
-    return 0;
-}
-
-void
-_PyCFunction_Fini(void)
-{
-    (void)PyCFunction_ClearFreeList();
-}
-
-
 /* Vectorcall functions for each of the PyCFunction calling conventions,
  * except for METH_VARARGS (possibly combined with METH_KEYWORDS) which
  * doesn't use vectorcall.
index 2149dbf569d6b8665bd4a030805bfe5a5b926633..44a4b18590b4b5e1913694c9c2a64649d5f2d85a 100644 (file)
@@ -1173,9 +1173,7 @@ finalize_interp_types(PyThreadState *tstate, int is_main_interp)
 {
     if (is_main_interp) {
         /* Sundry finalizers */
-        _PyMethod_Fini();
         _PyFrame_Fini();
-        _PyCFunction_Fini();
         _PyTuple_Fini();
         _PyList_Fini();
         _PySet_Fini();