]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-95977: Speed up calling pure python descriptor __get__ with vectorcall (gh-95978)
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Sun, 14 Aug 2022 15:13:42 +0000 (20:43 +0530)
committerGitHub <noreply@github.com>
Sun, 14 Aug 2022 15:13:42 +0000 (00:13 +0900)
Misc/NEWS.d/next/Core and Builtins/2022-08-14-10-04-44.gh-issue-95977.gCTZb9.rst [new file with mode: 0644]
Objects/typeobject.c

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 (file)
index 0000000..b265c77
--- /dev/null
@@ -0,0 +1 @@
+Optimized calling :meth:`~object.__get__` with vectorcall. Patch by Kumar Aditya.
index da02e86f94ed2cbb22e5513600bcf3b9250e9bcd..27b12a00d77f3798c3e579cc27da44453c1b66bf 100644 (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