diff options
author | INADA Naoki <songofacandy@gmail.com> | 2017-02-02 22:43:03 (GMT) |
---|---|---|
committer | INADA Naoki <songofacandy@gmail.com> | 2017-02-02 22:43:03 (GMT) |
commit | 5566bbb8d563646d83e8172410fa0c085e8233b1 (patch) | |
tree | cb8ca83c2b1a6eb01a6b51258532b4fccf548b6d /Objects/object.c | |
parent | 144fff8b900f9d452402a8e47ff79e88e4916d28 (diff) | |
download | cpython-5566bbb8d563646d83e8172410fa0c085e8233b1.zip cpython-5566bbb8d563646d83e8172410fa0c085e8233b1.tar.gz cpython-5566bbb8d563646d83e8172410fa0c085e8233b1.tar.bz2 |
Issue #29263: LOAD_METHOD support for C methods
Calling builtin method is at most 10% faster.
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/object.c b/Objects/object.c index 93cdc10..5da6cff 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -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; |