summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-08-14 15:13:42 (GMT)
committerGitHub <noreply@github.com>2022-08-14 15:13:42 (GMT)
commitf2afdf33523162d5911de3263b4a9785d7c49a20 (patch)
tree3e19b8e2aa4c5d547e91efef244f31dee35d554f
parentc26500224fe80559d1aa4973f22453c9ce2130ab (diff)
downloadcpython-f2afdf33523162d5911de3263b4a9785d7c49a20.zip
cpython-f2afdf33523162d5911de3263b4a9785d7c49a20.tar.gz
cpython-f2afdf33523162d5911de3263b4a9785d7c49a20.tar.bz2
GH-95977: Speed up calling pure python descriptor __get__ with vectorcall (gh-95978)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2022-08-14-10-04-44.gh-issue-95977.gCTZb9.rst1
-rw-r--r--Objects/typeobject.c3
2 files changed, 3 insertions, 1 deletions
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 0000000..b265c77
--- /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 da02e86..27b12a0 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