From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Sun, 14 Aug 2022 15:13:42 +0000 (+0530) Subject: GH-95977: Speed up calling pure python descriptor __get__ with vectorcall (gh-95978) X-Git-Tag: v3.12.0a1~652 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f2afdf33523162d5911de3263b4a9785d7c49a20;p=thirdparty%2FPython%2Fcpython.git GH-95977: Speed up calling pure python descriptor __get__ with vectorcall (gh-95978) --- 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 000000000000..b265c770233a --- /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 da02e86f94ed..27b12a00d77f 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