[Python-checkins] bpo-37151: use PyVectorcall_Call for all calls of "method" (GH-13972)

Inada Naoki webhook-mailer at python.org
Tue Jun 18 04:50:32 EDT 2019


https://github.com/python/cpython/commit/c78fe320dbb0da3412d640797eb850753d45c07b
commit: c78fe320dbb0da3412d640797eb850753d45c07b
branch: master
author: Jeroen Demeyer <J.Demeyer at UGent.be>
committer: Inada Naoki <songofacandy at gmail.com>
date: 2019-06-18T17:50:28+09:00
summary:

bpo-37151: use PyVectorcall_Call for all calls of "method" (GH-13972)

files:
M Objects/classobject.c

diff --git a/Objects/classobject.c b/Objects/classobject.c
index f26a85c62371..ec4d2b9910a2 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -329,17 +329,6 @@ method_traverse(PyMethodObject *im, visitproc visit, void *arg)
     return 0;
 }
 
-static PyObject *
-method_call(PyObject *method, PyObject *args, PyObject *kwargs)
-{
-    PyObject *self, *func;
-
-    self = PyMethod_GET_SELF(method);
-    func = PyMethod_GET_FUNCTION(method);
-
-    return _PyObject_Call_Prepend(func, self, args, kwargs);
-}
-
 static PyObject *
 method_descr_get(PyObject *meth, PyObject *obj, PyObject *cls)
 {
@@ -362,7 +351,7 @@ PyTypeObject PyMethod_Type = {
     0,                                          /* tp_as_sequence */
     0,                                          /* tp_as_mapping */
     (hashfunc)method_hash,                      /* tp_hash */
-    method_call,                                /* tp_call */
+    PyVectorcall_Call,                          /* tp_call */
     0,                                          /* tp_str */
     method_getattro,                            /* tp_getattro */
     PyObject_GenericSetAttr,                    /* tp_setattro */



More information about the Python-checkins mailing list