mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
If sys.trace is None, don't trace. For exceptions, only use
the local trace function.
This commit is contained in:
parent
6d80647f7f
commit
8ec25b410c
1 changed files with 7 additions and 6 deletions
|
@ -159,6 +159,10 @@ eval_code(co, globals, locals, arg)
|
||||||
|
|
||||||
trace = sysget("trace");
|
trace = sysget("trace");
|
||||||
if (trace != NULL) {
|
if (trace != NULL) {
|
||||||
|
if (trace == None) {
|
||||||
|
trace = NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
/* sys.trace, if defined, is a function that will
|
/* sys.trace, if defined, is a function that will
|
||||||
be called on *every* entry to a code block.
|
be called on *every* entry to a code block.
|
||||||
Its return value, if not None, is a function that
|
Its return value, if not None, is a function that
|
||||||
|
@ -185,6 +189,7 @@ eval_code(co, globals, locals, arg)
|
||||||
trace = NULL;
|
trace = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
next_instr = GETUSTRINGVALUE(f->f_code->co_code);
|
next_instr = GETUSTRINGVALUE(f->f_code->co_code);
|
||||||
stack_pointer = f->f_valuestack;
|
stack_pointer = f->f_valuestack;
|
||||||
|
@ -1057,11 +1062,7 @@ eval_code(co, globals, locals, arg)
|
||||||
f->f_lasti -= 2;
|
f->f_lasti -= 2;
|
||||||
tb_here(f);
|
tb_here(f);
|
||||||
|
|
||||||
if (trace)
|
if (trace) {
|
||||||
v = trace;
|
|
||||||
else
|
|
||||||
v = sysget("trace");
|
|
||||||
if (v) {
|
|
||||||
object *type, *value, *traceback, *arg;
|
object *type, *value, *traceback, *arg;
|
||||||
err_get(&type, &value);
|
err_get(&type, &value);
|
||||||
traceback = tb_fetch();
|
traceback = tb_fetch();
|
||||||
|
@ -1073,7 +1074,7 @@ eval_code(co, globals, locals, arg)
|
||||||
settupleitem(arg, 1, value);
|
settupleitem(arg, 1, value);
|
||||||
settupleitem(arg, 2, traceback);
|
settupleitem(arg, 2, traceback);
|
||||||
}
|
}
|
||||||
v = call_trace(v, f, "exception", arg);
|
v = call_trace(trace, f, "exception", arg);
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
/* Trace function raised error */
|
/* Trace function raised error */
|
||||||
tb_here(f);
|
tb_here(f);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue