diff options
author | Victor Stinner <vstinner@python.org> | 2019-11-20 11:59:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-20 11:59:12 (GMT) |
commit | 4dedd0f0ddc5a983a57bf0105eb34f948a91d2c4 (patch) | |
tree | 9b78468c58157901a86b70427eb97344b22634a4 | |
parent | 7247407c35330f3f6292f1d40606b7ba6afd5700 (diff) | |
download | cpython-4dedd0f0ddc5a983a57bf0105eb34f948a91d2c4.zip cpython-4dedd0f0ddc5a983a57bf0105eb34f948a91d2c4.tar.gz cpython-4dedd0f0ddc5a983a57bf0105eb34f948a91d2c4.tar.bz2 |
bpo-37340: Remove PyMethod_ClearFreeList() and PyCFunction_ClearFreeList() (GH-17284)
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.
-rw-r--r-- | Doc/whatsnew/3.9.rst | 5 | ||||
-rw-r--r-- | Include/classobject.h | 2 | ||||
-rw-r--r-- | Include/internal/pycore_pylifecycle.h | 2 | ||||
-rw-r--r-- | Include/methodobject.h | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/C API/2019-11-20-11-08-06.bpo-37340.JBQJMS.rst | 2 | ||||
-rw-r--r-- | Modules/gcmodule.c | 2 | ||||
-rw-r--r-- | Objects/classobject.c | 14 | ||||
-rw-r--r-- | Objects/methodobject.c | 15 | ||||
-rw-r--r-- | Python/pylifecycle.c | 2 |
9 files changed, 7 insertions, 39 deletions
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 542a031..281173e 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -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 ========== diff --git a/Include/classobject.h b/Include/classobject.h index c83303c..840431a 100644 --- a/Include/classobject.h +++ b/Include/classobject.h @@ -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; diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h index b8d5e36..c837bcd 100644 --- a/Include/internal/pycore_pylifecycle.h +++ b/Include/internal/pycore_pylifecycle.h @@ -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); diff --git a/Include/methodobject.h b/Include/methodobject.h index 3bccf5a..a15d05f 100644 --- a/Include/methodobject.h +++ b/Include/methodobject.h @@ -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 index 0000000..8ffa4eb --- /dev/null +++ b/Misc/NEWS.d/next/C API/2019-11-20-11-08-06.bpo-37340.JBQJMS.rst @@ -0,0 +1,2 @@ +Remove ``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()`` +functions: the free lists of bound method objects have been removed. diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 967bbe9..d232179 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -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(); diff --git a/Objects/classobject.c b/Objects/classobject.c index d3fc726..db53f04 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -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 */ diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 8f752c6..6a37238 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -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. diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 2149dbf..44a4b18 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -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(); |