GH-95977: Speed up calling pure python descriptor __get__ with vectorcall (gh-95978)

This commit is contained in:
Kumar Aditya 2022-08-14 20:43:42 +05:30 committed by GitHub
parent c26500224f
commit f2afdf3352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -0,0 +1 @@
Optimized calling :meth:`~object.__get__` with vectorcall. Patch by Kumar Aditya.

View File

@ -8242,7 +8242,8 @@ slot_tp_descr_get(PyObject *self, PyObject *obj, PyObject *type)
obj = Py_None;
if (type == NULL)
type = Py_None;
return PyObject_CallFunctionObjArgs(get, self, obj, type, NULL);
PyObject *stack[3] = {self, obj, type};
return PyObject_Vectorcall(get, stack, 3, NULL);
}
static int