summaryrefslogtreecommitdiffstats
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-05-05 20:56:21 (GMT)
committerGuido van Rossum <guido@python.org>1997-05-05 20:56:21 (GMT)
commita027efa5bfa7911b5c4b522b6a0698749a6f2e4a (patch)
tree7027609cb66223aba0355957599aa7629fce7e53 /Python/traceback.c
parent73237c54b40c345813fa6b7831a32b10fa4671b5 (diff)
downloadcpython-a027efa5bfa7911b5c4b522b6a0698749a6f2e4a.zip
cpython-a027efa5bfa7911b5c4b522b6a0698749a6f2e4a.tar.gz
cpython-a027efa5bfa7911b5c4b522b6a0698749a6f2e4a.tar.bz2
Massive changes for separate thread state management.
All per-thread globals are moved into a struct which is manipulated separately.
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index 14e4905..06fcc53 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -117,42 +117,18 @@ newtracebackobject(next, frame, lasti, lineno)
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;
}