bpo-36922: use Py_TPFLAGS_METHOD_DESCRIPTOR in lookup_maybe_method() (GH-13865)

This commit is contained in:
Jeroen Demeyer 2019-06-17 13:53:21 +02:00 committed by Inada Naoki
parent 0456df4a55
commit 2e9954d347
3 changed files with 4 additions and 1 deletions

View file

@ -1412,7 +1412,7 @@ lookup_maybe_method(PyObject *self, _Py_Identifier *attrid, int *unbound)
return NULL;
}
if (PyFunction_Check(res)) {
if (PyType_HasFeature(Py_TYPE(res), Py_TPFLAGS_METHOD_DESCRIPTOR)) {
/* Avoid temporary PyMethodObject */
*unbound = 1;
Py_INCREF(res);