mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
Fix bug:
[ 1163563 ] Sub threads execute in restricted mode basically by fixing bug 1010677 in a non-broken way. Backport candidate.
This commit is contained in:
parent
fb662972e0
commit
188d4366be
3 changed files with 65 additions and 18 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue