Issue #29263: LOAD_METHOD support for C methods

Calling builtin method is at most 10% faster.
This commit is contained in:
INADA Naoki 2017-02-03 07:43:03 +09:00
parent 144fff8b90
commit 5566bbb8d5
8 changed files with 88 additions and 36 deletions

View file

@ -1060,8 +1060,8 @@ _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method)
descr = _PyType_Lookup(tp, name);
if (descr != NULL) {
Py_INCREF(descr);
if (PyFunction_Check(descr)) {
/* A python method. */
if (PyFunction_Check(descr) ||
(Py_TYPE(descr) == &PyMethodDescr_Type)) {
meth_found = 1;
} else {
f = descr->ob_type->tp_descr_get;