File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed
Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ struct _ceval_runtime_state;
1717
1818extern void _Py_FinishPendingCalls (PyThreadState * tstate );
1919extern void _PyEval_InitRuntimeState (struct _ceval_runtime_state * );
20- extern int _PyEval_InitState (struct _ceval_state * ceval );
20+ extern void _PyEval_InitState (struct _ceval_state * , PyThread_type_lock );
2121extern void _PyEval_FiniState (struct _ceval_state * ceval );
2222PyAPI_FUNC (void ) _PyEval_SignalReceived (PyInterpreterState * interp );
2323PyAPI_FUNC (int ) _PyEval_AddPendingCall (
Original file line number Diff line number Diff line change @@ -747,24 +747,19 @@ _PyEval_InitRuntimeState(struct _ceval_runtime_state *ceval)
747747#endif
748748}
749749
750- int
751- _PyEval_InitState (struct _ceval_state * ceval )
750+ void
751+ _PyEval_InitState (struct _ceval_state * ceval , PyThread_type_lock pending_lock )
752752{
753753 ceval -> recursion_limit = Py_DEFAULT_RECURSION_LIMIT ;
754754
755755 struct _pending_calls * pending = & ceval -> pending ;
756756 assert (pending -> lock == NULL );
757757
758- pending -> lock = PyThread_allocate_lock ();
759- if (pending -> lock == NULL ) {
760- return -1 ;
761- }
758+ pending -> lock = pending_lock ;
762759
763760#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
764761 _gil_initialize (& ceval -> gil );
765762#endif
766-
767- return 0 ;
768763}
769764
770765void
Original file line number Diff line number Diff line change @@ -225,10 +225,12 @@ PyInterpreterState_New(void)
225225 _PyRuntimeState * runtime = & _PyRuntime ;
226226 interp -> runtime = runtime ;
227227
228- if (_PyEval_InitState (& interp -> ceval ) < 0 ) {
228+ PyThread_type_lock pending_lock = PyThread_allocate_lock ();
229+ if (pending_lock == NULL ) {
229230 goto out_of_memory ;
230231 }
231232
233+ _PyEval_InitState (& interp -> ceval , pending_lock );
232234 _PyGC_InitState (& interp -> gc );
233235 PyConfig_InitPythonConfig (& interp -> config );
234236 _PyType_InitCache (interp );
You can’t perform that action at this time.
0 commit comments