summaryrefslogtreecommitdiffstats
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index db4682c..5130551 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -7782,10 +7782,17 @@ slot_tp_getattro(PyObject *self, PyObject *name)
return vectorcall_method(&_Py_ID(__getattribute__), stack, 2);
}
-static PyObject *
+static inline PyObject *
call_attribute(PyObject *self, PyObject *attr, PyObject *name)
{
PyObject *res, *descr = NULL;
+
+ if (_PyType_HasFeature(Py_TYPE(attr), Py_TPFLAGS_METHOD_DESCRIPTOR)) {
+ PyObject *args[] = { self, name };
+ res = PyObject_Vectorcall(attr, args, 2, NULL);
+ return res;
+ }
+
descrgetfunc f = Py_TYPE(attr)->tp_descr_get;
if (f != NULL) {