Optimize methoddescr_call(): avoid temporary PyCFunction

Issue #29259, #29263. methoddescr_call() creates a PyCFunction object, call it
and the destroy it. Add a new _PyMethodDef_RawFastCallDict() method to avoid
the temporary PyCFunction object.
This commit is contained in:
Victor Stinner 2017-01-18 10:38:09 +01:00
parent 35ecebe165
commit c52572319c
3 changed files with 40 additions and 26 deletions

View file

@ -95,6 +95,13 @@ typedef struct {
PyObject *m_module; /* The __module__ attribute, can be anything */
PyObject *m_weakreflist; /* List of weak references */
} PyCFunctionObject;
PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallDict(
PyMethodDef *method,
PyObject *self,
PyObject **args,
Py_ssize_t nargs,
PyObject *kwargs);
#endif
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);