Mercurial > cpython-lru_cache-weakref
diff Modules/threadmodule.c @ 35117:7ea2be2c0e1d legacy-trunk
Fix bug:
[ 1163563 ] Sub threads execute in restricted mode
basically by fixing bug 1010677 in a non-broken way.
Backport candidate.
| author | Michael W. Hudson <mwh@python.net> |
|---|---|
| date | Mon, 20 Jun 2005 16:52:57 +0000 |
| parents | c6b7fadf0ada |
| children | 1af7f719ed28 |
line wrap: on
line diff
--- a/Modules/threadmodule.c Mon Jun 20 16:37:03 2005 +0000 +++ b/Modules/threadmodule.c Mon Jun 20 16:52:57 2005 +0000 @@ -413,10 +413,12 @@ 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 @@ Py_DECREF(boot->args); Py_XDECREF(boot->keyw); PyMem_DEL(boot_raw); - PyGILState_Release(gstate); + PyThreadState_Clear(tstate); + PyThreadState_DeleteCurrent(); PyThread_exit_thread(); }
