Mercurial > cpython-lru_cache-weakref
diff Modules/threadmodule.c @ 35631:c260d3b7d582 2.4
Backport bugfix:
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 | Fri, 23 Sep 2005 08:14:40 +0000 |
| parents | b4cb49829d3e |
| children | 6fb46e87d5f9 |
line wrap: on
line diff
--- a/Modules/threadmodule.c Fri Sep 23 04:28:23 2005 +0000 +++ b/Modules/threadmodule.c Fri Sep 23 08:14:40 2005 +0000 @@ -425,10 +425,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) { @@ -453,7 +455,8 @@ Py_DECREF(boot->args); Py_XDECREF(boot->keyw); PyMem_DEL(boot_raw); - PyGILState_Release(gstate); + PyThreadState_Clear(tstate); + PyThreadState_DeleteCurrent(); PyThread_exit_thread(); }
