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;
17
17
18
18
extern void _Py_FinishPendingCalls (PyThreadState * tstate );
19
19
extern 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 );
21
21
extern void _PyEval_FiniState (struct _ceval_state * ceval );
22
22
PyAPI_FUNC (void ) _PyEval_SignalReceived (PyInterpreterState * interp );
23
23
PyAPI_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)
747
747
#endif
748
748
}
749
749
750
- int
751
- _PyEval_InitState (struct _ceval_state * ceval )
750
+ void
751
+ _PyEval_InitState (struct _ceval_state * ceval , PyThread_type_lock pending_lock )
752
752
{
753
753
ceval -> recursion_limit = Py_DEFAULT_RECURSION_LIMIT ;
754
754
755
755
struct _pending_calls * pending = & ceval -> pending ;
756
756
assert (pending -> lock == NULL );
757
757
758
- pending -> lock = PyThread_allocate_lock ();
759
- if (pending -> lock == NULL ) {
760
- return -1 ;
761
- }
758
+ pending -> lock = pending_lock ;
762
759
763
760
#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
764
761
_gil_initialize (& ceval -> gil );
765
762
#endif
766
-
767
- return 0 ;
768
763
}
769
764
770
765
void
Original file line number Diff line number Diff line change @@ -225,10 +225,12 @@ PyInterpreterState_New(void)
225
225
_PyRuntimeState * runtime = & _PyRuntime ;
226
226
interp -> runtime = runtime ;
227
227
228
- if (_PyEval_InitState (& interp -> ceval ) < 0 ) {
228
+ PyThread_type_lock pending_lock = PyThread_allocate_lock ();
229
+ if (pending_lock == NULL ) {
229
230
goto out_of_memory ;
230
231
}
231
232
233
+ _PyEval_InitState (& interp -> ceval , pending_lock );
232
234
_PyGC_InitState (& interp -> gc );
233
235
PyConfig_InitPythonConfig (& interp -> config );
234
236
_PyType_InitCache (interp );
You can’t perform that action at this time.
0 commit comments