diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 11 | ||||
-rw-r--r-- | Python/pystate.c | 4 |
2 files changed, 6 insertions, 9 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index c22af02..36d1360 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -747,24 +747,19 @@ _PyEval_InitRuntimeState(struct _ceval_runtime_state *ceval) #endif } -int -_PyEval_InitState(struct _ceval_state *ceval) +void +_PyEval_InitState(struct _ceval_state *ceval, PyThread_type_lock pending_lock) { ceval->recursion_limit = Py_DEFAULT_RECURSION_LIMIT; struct _pending_calls *pending = &ceval->pending; assert(pending->lock == NULL); - pending->lock = PyThread_allocate_lock(); - if (pending->lock == NULL) { - return -1; - } + pending->lock = pending_lock; #ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS _gil_initialize(&ceval->gil); #endif - - return 0; } void diff --git a/Python/pystate.c b/Python/pystate.c index ba14c9d..a0bd050 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -225,10 +225,12 @@ PyInterpreterState_New(void) _PyRuntimeState *runtime = &_PyRuntime; interp->runtime = runtime; - if (_PyEval_InitState(&interp->ceval) < 0) { + PyThread_type_lock pending_lock = PyThread_allocate_lock(); + if (pending_lock == NULL) { goto out_of_memory; } + _PyEval_InitState(&interp->ceval, pending_lock); _PyGC_InitState(&interp->gc); PyConfig_InitPythonConfig(&interp->config); _PyType_InitCache(interp); |