@@ -152,17 +152,14 @@ PyCFunction_Call(PyObject *func, PyObject *args, PyObject *kwds)
152
152
}
153
153
154
154
PyObject *
155
- _PyCFunction_FastCallDict ( PyObject * func_obj , PyObject * * args , Py_ssize_t nargs ,
156
- PyObject * kwargs )
155
+ _PyMethodDef_RawFastCallDict ( PyMethodDef * method , PyObject * self , PyObject * * args ,
156
+ Py_ssize_t nargs , PyObject * kwargs )
157
157
{
158
- PyCFunctionObject * func ;
159
158
PyCFunction meth ;
160
- PyObject * self ;
161
159
PyObject * result ;
162
160
int flags ;
163
161
164
- assert (func_obj != NULL );
165
- assert (PyCFunction_Check (func_obj ));
162
+ assert (method != NULL );
166
163
assert (nargs >= 0 );
167
164
assert (nargs == 0 || args != NULL );
168
165
assert (kwargs == NULL || PyDict_Check (kwargs ));
@@ -172,10 +169,8 @@ _PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, Py_ssize_t nargs,
172
169
caller loses its exception */
173
170
assert (!PyErr_Occurred ());
174
171
175
- func = (PyCFunctionObject * )func_obj ;
176
- meth = PyCFunction_GET_FUNCTION (func );
177
- self = PyCFunction_GET_SELF (func );
178
- flags = PyCFunction_GET_FLAGS (func ) & ~(METH_CLASS | METH_STATIC | METH_COEXIST );
172
+ meth = method -> ml_meth ;
173
+ flags = method -> ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST );
179
174
180
175
switch (flags )
181
176
{
@@ -186,7 +181,7 @@ _PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, Py_ssize_t nargs,
186
181
187
182
if (kwargs != NULL && PyDict_GET_SIZE (kwargs ) != 0 ) {
188
183
PyErr_Format (PyExc_TypeError , "%.200s() takes no keyword arguments" ,
189
- func -> m_ml -> ml_name );
184
+ method -> ml_name );
190
185
return NULL ;
191
186
}
192
187
@@ -197,7 +192,7 @@ _PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, Py_ssize_t nargs,
197
192
if (nargs != 1 ) {
198
193
PyErr_Format (PyExc_TypeError ,
199
194
"%.200s() takes exactly one argument (%zd given)" ,
200
- func -> m_ml -> ml_name , nargs );
195
+ method -> ml_name , nargs );
201
196
return NULL ;
202
197
}
203
198
@@ -259,17 +254,31 @@ _PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, Py_ssize_t nargs,
259
254
return NULL ;
260
255
}
261
256
262
- result = _Py_CheckFunctionResult (func_obj , result , NULL );
263
-
264
257
return result ;
265
258
266
259
no_keyword_error :
267
260
PyErr_Format (PyExc_TypeError ,
268
261
"%.200s() takes no arguments (%zd given)" ,
269
- func -> m_ml -> ml_name , nargs );
262
+ method -> ml_name , nargs );
270
263
return NULL ;
271
264
}
272
265
266
+ PyObject *
267
+ _PyCFunction_FastCallDict (PyObject * func , PyObject * * args , Py_ssize_t nargs ,
268
+ PyObject * kwargs )
269
+ {
270
+ PyObject * result ;
271
+
272
+ assert (func != NULL );
273
+ assert (PyCFunction_Check (func ));
274
+
275
+ result = _PyMethodDef_RawFastCallDict (((PyCFunctionObject * )func )-> m_ml ,
276
+ PyCFunction_GET_SELF (func ),
277
+ args , nargs , kwargs );
278
+ result = _Py_CheckFunctionResult (func , result , NULL );
279
+ return result ;
280
+ }
281
+
273
282
PyObject *
274
283
_PyCFunction_FastCallKeywords (PyObject * func_obj , PyObject * * args ,
275
284
Py_ssize_t nargs , PyObject * kwnames )
0 commit comments