trace = sysget("trace");
if (trace != NULL) {
+ if (trace == None) {
+ trace = NULL;
+ }
+ else {
/* sys.trace, if defined, is a function that will
be called on *every* entry to a code block.
Its return value, if not None, is a function that
DECREF(trace);
trace = NULL;
}
+ }
}
next_instr = GETUSTRINGVALUE(f->f_code->co_code);
f->f_lasti -= 2;
tb_here(f);
- if (trace)
- v = trace;
- else
- v = sysget("trace");
- if (v) {
+ if (trace) {
object *type, *value, *traceback, *arg;
err_get(&type, &value);
traceback = tb_fetch();
settupleitem(arg, 1, value);
settupleitem(arg, 2, traceback);
}
- v = call_trace(v, f, "exception", arg);
+ v = call_trace(trace, f, "exception", arg);
if (v == NULL) {
/* Trace function raised error */
tb_here(f);