summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2005-09-23 08:14:40 (GMT)
committerMichael W. Hudson <mwh@python.net>2005-09-23 08:14:40 (GMT)
commitb21d81e771d2d3daa9a2ce0a3a018fa517c7b658 (patch)
tree1b5422189b47462c2bba12be7538a8975b0053f9 /Modules
parent98d504a0e121b3731a4f10c58d9e594f60b78b94 (diff)
downloadcpython-b21d81e771d2d3daa9a2ce0a3a018fa517c7b658.zip
cpython-b21d81e771d2d3daa9a2ce0a3a018fa517c7b658.tar.gz
cpython-b21d81e771d2d3daa9a2ce0a3a018fa517c7b658.tar.bz2
Backport bugfix:
Fix bug: [ 1163563 ] Sub threads execute in restricted mode basically by fixing bug 1010677 in a non-broken way. Backport candidate.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/threadmodule.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index cba01fa..052262c 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -425,10 +425,12 @@ static void
t_bootstrap(void *boot_raw)
{
struct bootstate *boot = (struct bootstate *) boot_raw;
- PyGILState_STATE gstate;
+ PyThreadState *tstate;
PyObject *res;
- gstate = PyGILState_Ensure();
+ tstate = PyThreadState_New(boot->interp);
+
+ PyEval_AcquireThread(tstate);
res = PyEval_CallObjectWithKeywords(
boot->func, boot->args, boot->keyw);
if (res == NULL) {
@@ -453,7 +455,8 @@ t_bootstrap(void *boot_raw)
Py_DECREF(boot->args);
Py_XDECREF(boot->keyw);
PyMem_DEL(boot_raw);
- PyGILState_Release(gstate);
+ PyThreadState_Clear(tstate);
+ PyThreadState_DeleteCurrent();
PyThread_exit_thread();
}