|
|
|
@ -4566,10 +4566,16 @@ call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames) |
|
|
|
} |
|
|
|
else if (Py_TYPE(func) == &PyMethodDescr_Type) { |
|
|
|
PyThreadState *tstate = PyThreadState_GET(); |
|
|
|
if (tstate->use_tracing && tstate->c_profilefunc) { |
|
|
|
// We need to create PyCFunctionObject for tracing. |
|
|
|
PyMethodDescrObject *descr = (PyMethodDescrObject*)func; |
|
|
|
func = PyCFunction_NewEx(descr->d_method, stack[0], NULL); |
|
|
|
if (nargs > 0 && tstate->use_tracing) { |
|
|
|
/* We need to create a temporary bound method as argument |
|
|
|
for profiling. |
|
|
|
|
|
|
|
If nargs == 0, then this cannot work because we have no |
|
|
|
"self". In any case, the call itself would raise |
|
|
|
TypeError (foo needs an argument), so we just skip |
|
|
|
profiling. */ |
|
|
|
PyObject *self = stack[0]; |
|
|
|
func = Py_TYPE(func)->tp_descr_get(func, self, (PyObject*)Py_TYPE(self)); |
|
|
|
if (func == NULL) { |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
|