summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorJesse Noller <jnoller@gmail.com>2008-07-17 16:49:17 (GMT)
committerJesse Noller <jnoller@gmail.com>2008-07-17 16:49:17 (GMT)
commita851397ddcff527881407f25b13f836a3fc57ee5 (patch)
treeab06e41a055e91afd8beb6edcc6496d6fffffb6a /Python/ceval.c
parente921e02a2e97cc418a1c8faec135056802849864 (diff)
downloadcpython-a851397ddcff527881407f25b13f836a3fc57ee5.zip
cpython-a851397ddcff527881407f25b13f836a3fc57ee5.tar.gz
cpython-a851397ddcff527881407f25b13f836a3fc57ee5.tar.bz2
Merger 65032 to py3k
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index c75caf6..9601de5 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -266,6 +266,9 @@ PyEval_ReleaseThread(PyThreadState *tstate)
void
PyEval_ReInitThreads(void)
{
+ PyObject *threading, *result;
+ PyThreadState *tstate;
+
if (!interpreter_lock)
return;
/*XXX Can't use PyThread_free_lock here because it does too
@@ -275,6 +278,23 @@ PyEval_ReInitThreads(void)
interpreter_lock = PyThread_allocate_lock();
PyThread_acquire_lock(interpreter_lock, 1);
main_thread = PyThread_get_thread_ident();
+
+ /* Update the threading module with the new state.
+ */
+ tstate = PyThreadState_GET();
+ threading = PyMapping_GetItemString(tstate->interp->modules,
+ "threading");
+ if (threading == NULL) {
+ /* threading not imported */
+ PyErr_Clear();
+ return;
+ }
+ result = PyObject_CallMethod(threading, "_after_fork", NULL);
+ if (result == NULL)
+ PyErr_WriteUnraisable(threading);
+ else
+ Py_DECREF(result);
+ Py_DECREF(threading);
}
#endif