diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-08-14-10-04-44.gh-issue-95977.gCTZb9.rst b/Misc/NEWS.d/next/Core and Builtins/2022-08-14-10-04-44.gh-issue-95977.gCTZb9.rst new file mode 100644 index 00000000000..b265c770233 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2022-08-14-10-04-44.gh-issue-95977.gCTZb9.rst @@ -0,0 +1 @@ +Optimized calling :meth:`~object.__get__` with vectorcall. Patch by Kumar Aditya. diff --git a/Objects/typeobject.c b/Objects/typeobject.c index da02e86f94e..27b12a00d77 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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