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.
This commit is contained in:
Victor Stinner 2019-11-20 12:59:12 +01:00 committed by GitHub
parent 7247407c35
commit 4dedd0f0dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 7 additions and 39 deletions

View 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
==========

View 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;

View 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);

View file

@ -97,8 +97,6 @@ typedef struct {
} PyCFunctionObject;
#endif
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,2 @@
Remove ``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()``
functions: the free lists of bound method objects have been removed.

View 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();

View 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
*/

View 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.

View 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();