Commit cfe68067 authored by Stefan Behnel's avatar Stefan Behnel

guard tracing calls against re-entry, handle errors in trace function calls

parent d75f8d93
...@@ -136,17 +136,18 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, ...@@ -136,17 +136,18 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
#endif #endif
} }
(*frame)->f_lineno = firstlineno; (*frame)->f_lineno = firstlineno;
retval = 1;
tstate->tracing++;
tstate->use_tracing = 0; tstate->use_tracing = 0;
#if CYTHON_TRACE #if CYTHON_TRACE
if (tstate->c_tracefunc) if (tstate->c_tracefunc)
tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL); retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
if (!tstate->c_profilefunc) if (retval && tstate->c_profilefunc)
retval = 1;
else
#endif #endif
retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0; retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
tstate->use_tracing = (tstate->c_profilefunc || tstate->use_tracing = (tstate->c_profilefunc ||
(CYTHON_TRACE && tstate->c_tracefunc)); (CYTHON_TRACE && tstate->c_tracefunc));
tstate->tracing--;
return tstate->use_tracing && retval; return tstate->use_tracing && retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment