summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-08-02 03:10:38 (GMT)
committerGuido van Rossum <guido@python.org>1997-08-02 03:10:38 (GMT)
commit25ce566661c1b7446b3ddb4076513a62f93ce08d (patch)
tree39efd7dea3c5cf687c84ec4af49614b725755525 /Python/ceval.c
parent40b33c648a2d777636603356c12b644dd4c92876 (diff)
downloadcpython-25ce566661c1b7446b3ddb4076513a62f93ce08d.zip
cpython-25ce566661c1b7446b3ddb4076513a62f93ce08d.tar.gz
cpython-25ce566661c1b7446b3ddb4076513a62f93ce08d.tar.bz2
The last of the mass checkins for separate (sub)interpreters.
Everything should now work again. See the comments for the .h files mass checkin (e.g. pystate.h) for more detail.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 205d8d4..bb0fb65 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -130,6 +130,18 @@ PyEval_InitThreads()
}
void
+PyEval_AcquireLock()
+{
+ acquire_lock(interpreter_lock, 1);
+}
+
+void
+PyEval_ReleaseLock()
+{
+ release_lock(interpreter_lock);
+}
+
+void
PyEval_AcquireThread(tstate)
PyThreadState *tstate;
{
@@ -402,9 +414,6 @@ eval_code2(co, globals, locals,
/* Start of code */
- if (tstate == NULL)
- Py_FatalError("eval_code2 called without a current thread");
-
#ifdef USE_STACKCHECK
if (tstate->recursion_depth%10 == 0 && PyOS_CheckStack()) {
PyErr_SetString(PyExc_MemoryError, "Stack overflow");
@@ -590,7 +599,7 @@ eval_code2(co, globals, locals,
Py_MakePendingCalls() above. */
if (things_to_do || --tstate->ticker < 0) {
- tstate->ticker = tstate->sys_checkinterval;
+ tstate->ticker = tstate->interp->checkinterval;
if (things_to_do) {
if (Py_MakePendingCalls() < 0) {
why = WHY_EXCEPTION;
@@ -612,14 +621,15 @@ eval_code2(co, globals, locals,
if (interpreter_lock) {
/* Give another thread a chance */
- PyThreadState *tstate =
- PyThreadState_Swap(NULL);
+ if (PyThreadState_Swap(NULL) != tstate)
+ Py_FatalError("ceval: tstate mix-up");
release_lock(interpreter_lock);
/* Other threads may run now */
acquire_lock(interpreter_lock, 1);
- PyThreadState_Swap(tstate);
+ if (PyThreadState_Swap(tstate) != NULL)
+ Py_FatalError("ceval: orphan tstate");
}
#endif
}
@@ -2176,9 +2186,10 @@ call_trace(p_trace, p_newtrace, f, msg, arg)
PyObject *
PyEval_GetBuiltins()
{
- PyFrameObject *current_frame = PyThreadState_Get()->frame;
+ PyThreadState *tstate = PyThreadState_Get();
+ PyFrameObject *current_frame = tstate->frame;
if (current_frame == NULL)
- return PyBuiltin_GetModule();
+ return tstate->interp->builtins;
else
return current_frame->f_builtins;
}