diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2015-02-07 12:05:09 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2015-02-07 12:05:09 +0100 |
commit | cfe680672bbcd70c6c62c79f706259b68a60095a (patch) | |
tree | d82f22ba80f4fd8fd2a3bee2960855f2b2f18b55 | |
parent | d75f8d93bb60b7195e73bc9930570492f0b4ce05 (diff) | |
download | cython-cfe680672bbcd70c6c62c79f706259b68a60095a.tar.gz |
guard tracing calls against re-entry, handle errors in trace function calls
-rw-r--r-- | Cython/Utility/Profile.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Cython/Utility/Profile.c b/Cython/Utility/Profile.c index e416e66c4..73e1a4122 100644 --- a/Cython/Utility/Profile.c +++ b/Cython/Utility/Profile.c @@ -136,17 +136,18 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, #endif } (*frame)->f_lineno = firstlineno; + retval = 1; + tstate->tracing++; tstate->use_tracing = 0; #if CYTHON_TRACE if (tstate->c_tracefunc) - tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL); - if (!tstate->c_profilefunc) - retval = 1; - else + retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0; + if (retval && tstate->c_profilefunc) #endif retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0; tstate->use_tracing = (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc)); + tstate->tracing--; return tstate->use_tracing && retval; } |