Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 607:0214bbf47bf6 legacy-trunk
If sys.trace is None, don't trace. For exceptions, only use
the local trace function.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Sun, 19 Jan 1992 16:26:13 +0000 |
| parents | bae1494f2ec8 |
| children | 7e5f4d9aee77 |
line wrap: on
line diff
--- a/Python/ceval.c Sun Jan 19 16:25:49 1992 +0000 +++ b/Python/ceval.c Sun Jan 19 16:26:13 1992 +0000 @@ -159,6 +159,10 @@ 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 @@ DECREF(trace); trace = NULL; } + } } next_instr = GETUSTRINGVALUE(f->f_code->co_code); @@ -1057,11 +1062,7 @@ 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 @@ 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);
