@@ -213,7 +213,7 @@ static PyObject *
213213methoddescr_call (PyMethodDescrObject * descr , PyObject * args , PyObject * kwds )
214214{
215215 Py_ssize_t argc ;
216- PyObject * self , * func , * result ;
216+ PyObject * self , * func , * result , * * stack ;
217217
218218 /* Make sure that the first argument is acceptable as 'self' */
219219 assert (PyTuple_Check (args ));
@@ -242,13 +242,8 @@ methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds)
242242 func = PyCFunction_NewEx (descr -> d_method , self , NULL );
243243 if (func == NULL )
244244 return NULL ;
245- args = PyTuple_GetSlice (args , 1 , argc );
246- if (args == NULL ) {
247- Py_DECREF (func );
248- return NULL ;
249- }
250- result = PyEval_CallObjectWithKeywords (func , args , kwds );
251- Py_DECREF (args );
245+ stack = & PyTuple_GET_ITEM (args , 1 );
246+ result = _PyObject_FastCallDict (func , stack , argc - 1 , kwds );
252247 Py_DECREF (func );
253248 return result ;
254249}
@@ -258,7 +253,7 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
258253 PyObject * kwds )
259254{
260255 Py_ssize_t argc ;
261- PyObject * self , * func , * result ;
256+ PyObject * self , * func , * result , * * stack ;
262257
263258 /* Make sure that the first argument is acceptable as 'self' */
264259 assert (PyTuple_Check (args ));
@@ -295,22 +290,17 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
295290 func = PyCFunction_NewEx (descr -> d_method , self , NULL );
296291 if (func == NULL )
297292 return NULL ;
298- args = PyTuple_GetSlice (args , 1 , argc );
299- if (args == NULL ) {
300- Py_DECREF (func );
301- return NULL ;
302- }
303- result = PyEval_CallObjectWithKeywords (func , args , kwds );
293+ stack = & PyTuple_GET_ITEM (args , 1 );
294+ result = _PyObject_FastCallDict (func , stack , argc - 1 , kwds );
304295 Py_DECREF (func );
305- Py_DECREF (args );
306296 return result ;
307297}
308298
309299static PyObject *
310300wrapperdescr_call (PyWrapperDescrObject * descr , PyObject * args , PyObject * kwds )
311301{
312302 Py_ssize_t argc ;
313- PyObject * self , * func , * result ;
303+ PyObject * self , * func , * result , * * stack ;
314304
315305 /* Make sure that the first argument is acceptable as 'self' */
316306 assert (PyTuple_Check (args ));
@@ -339,13 +329,9 @@ wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds)
339329 func = PyWrapper_New ((PyObject * )descr , self );
340330 if (func == NULL )
341331 return NULL ;
342- args = PyTuple_GetSlice (args , 1 , argc );
343- if (args == NULL ) {
344- Py_DECREF (func );
345- return NULL ;
346- }
347- result = PyEval_CallObjectWithKeywords (func , args , kwds );
348- Py_DECREF (args );
332+
333+ stack = & PyTuple_GET_ITEM (args , 1 );
334+ result = _PyObject_FastCallDict (func , stack , argc - 1 , kwds );
349335 Py_DECREF (func );
350336 return result ;
351337}
0 commit comments