summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-01-19 16:26:13 (GMT)
committerGuido van Rossum <guido@python.org>1992-01-19 16:26:13 (GMT)
commit8ec25b410c7718d118cc6496c5aabe6fbbc7544f (patch)
tree3832a2e615dda59b09315da482c3c73ec3737526 /Python/ceval.c
parent6d80647f7f82d8a0aba2d735ca9d894cadd3b332 (diff)
downloadcpython-8ec25b410c7718d118cc6496c5aabe6fbbc7544f.zip
cpython-8ec25b410c7718d118cc6496c5aabe6fbbc7544f.tar.gz
cpython-8ec25b410c7718d118cc6496c5aabe6fbbc7544f.tar.bz2
If sys.trace is None, don't trace. For exceptions, only use
the local trace function.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index cc2f034..fc21706 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -159,6 +159,10 @@ eval_code(co, globals, locals, arg)
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
@@ -184,6 +188,7 @@ eval_code(co, globals, locals, arg)
DECREF(trace);
trace = NULL;
}
+ }
}
next_instr = GETUSTRINGVALUE(f->f_code->co_code);
@@ -1057,11 +1062,7 @@ eval_code(co, globals, locals, arg)
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();
@@ -1073,7 +1074,7 @@ eval_code(co, globals, locals, arg)
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);