diff Python/traceback.c @ 5405:b7871ca930ad legacy-trunk

Massive changes for separate thread state management. All per-thread globals are moved into a struct which is manipulated separately.
author Guido van Rossum <guido@python.org>
date Mon, 05 May 1997 20:56:21 +0000
parents 3780cce14f7d
children 79e49cbce2ef
line wrap: on
line diff
--- a/Python/traceback.c	Mon May 05 20:53:25 1997 +0000
+++ b/Python/traceback.c	Mon May 05 20:56:21 1997 +0000
@@ -117,42 +117,18 @@
 	return tb;
 }
 
-static tracebackobject *tb_current = NULL;
-
 int
 PyTraceBack_Here(frame)
 	PyFrameObject *frame;
 {
-	tracebackobject *tb;
-	tb = newtracebackobject(tb_current, frame,
-				frame->f_lasti, frame->f_lineno);
+	PyThreadState *tstate = frame->f_tstate;
+	tracebackobject *oldtb = (tracebackobject *) tstate->curexc_traceback;
+	tracebackobject *tb = newtracebackobject(oldtb,
+				frame, frame->f_lasti, frame->f_lineno);
 	if (tb == NULL)
 		return -1;
-	Py_XDECREF(tb_current);
-	tb_current = tb;
-	return 0;
-}
-
-PyObject *
-PyTraceBack_Fetch()
-{
-	PyObject *v;
-	v = (PyObject *)tb_current;
-	tb_current = NULL;
-	return v;
-}
-
-int
-PyTraceBack_Store(v)
-	PyObject *v;
-{
-	if (v != NULL && !is_tracebackobject(v)) {
-		PyErr_BadInternalCall();
-		return -1;
-	}
-	Py_XDECREF(tb_current);
-	Py_XINCREF(v);
-	tb_current = (tracebackobject *)v;
+	tstate->curexc_traceback = (PyObject *)tb;
+	Py_XDECREF(oldtb);
 	return 0;
 }