diff Python/ceval.c @ 11263:47171f2d7d58 legacy-trunk

call_trace(): A fix for PR#73, if an exception occurred in the 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.
author Barry Warsaw <barry@python.org>
date Wed, 08 Sep 1999 16:26:33 +0000
parents 3be935be3781
children 507546a87dcf
line wrap: on
line diff
--- a/Python/ceval.c	Wed Sep 08 02:42:30 1999 +0000
+++ b/Python/ceval.c	Wed Sep 08 16:26:33 1999 +0000
@@ -2201,6 +2201,14 @@
 			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 {