diff options
author | Michael W. Hudson <mwh@python.net> | 2005-06-20 16:52:57 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2005-06-20 16:52:57 (GMT) |
commit | 188d4366bed88bbca777c05e7f1a5cb3878ff335 (patch) | |
tree | b77be5cef3108cf44dbf6bcd8e53dc23a77112e7 /Modules/threadmodule.c | |
parent | fb662972e001aa051e5085862cf5eac323e1756f (diff) | |
download | cpython-188d4366bed88bbca777c05e7f1a5cb3878ff335.zip cpython-188d4366bed88bbca777c05e7f1a5cb3878ff335.tar.gz cpython-188d4366bed88bbca777c05e7f1a5cb3878ff335.tar.bz2 |
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/threadmodule.c')
-rw-r--r-- | Modules/threadmodule.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c index 098a784..3025595 100644 --- a/Modules/threadmodule.c +++ b/Modules/threadmodule.c @@ -413,10 +413,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) { @@ -441,7 +443,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(); } |