]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
call_trace(): A fix for PR#73, if an exception occurred in the
authorBarry Warsaw <barry@python.org>
Wed, 8 Sep 1999 16:26:33 +0000 (16:26 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 8 Sep 1999 16:26:33 +0000 (16:26 +0000)
tracefunc (or profilefunc -- we're not sure which), zap the global
trace and profile funcs so that we can't get into recursive loop when
instantiating the resulting class based exception.

Python/ceval.c

index 1c51ccf1356478f3ac49db7763c553f364b7470c..4c1bf2f8b4304d66e09c6c92faae2e97ef18ffe9 100644 (file)
@@ -2201,6 +2201,14 @@ call_trace(p_trace, p_newtrace, f, msg, arg)
                        Py_XDECREF(*p_newtrace);
                        *p_newtrace = NULL;
                }
+               /* to be extra double plus sure we don't get recursive
+                * calls inf either tracefunc or profilefunc gets an
+                * exception, zap the global variables.
+                */
+               Py_XDECREF(tstate->sys_tracefunc);
+               tstate->sys_tracefunc = NULL;
+               Py_XDECREF(tstate->sys_profilefunc);
+               tstate->sys_profilefunc = NULL;
                return -1;
        }
        else {