File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1001,8 +1001,8 @@ def start(self):
10011001 raise
10021002 self ._os_thread_handle .wait_bootstraped ()
10031003
1004- # It's possible that the _started event never occurs from the new Thread;
1005- # e.g., it didn't have enough memory to call the initialization part of _bootstrap_inner.
1004+ # It's possible that the _bootstrap(_inner) fails in the new Thread (e.g. Memory Error) ;
1005+ # We have to clean `_limbo` and `_active` here to avoid inconsistent state as much as possible
10061006 if self ._os_thread_handle .is_failed ():
10071007 with _active_limbo_lock :
10081008 _limbo .pop (self , None )
Original file line number Diff line number Diff line change @@ -398,8 +398,8 @@ thread_run(void *boot_raw)
398398 PyErr_FormatUnraisable (
399399 "Exception ignored in thread started by %R" , boot -> func );
400400 }
401+ // Notify that the bootstraped is done and failed (e.g. Memory error).
401402 set_thread_handle_state (handle , THREAD_HANDLE_FAILED );
402- // Notify that the bootstraped is done, in case the Python didn't bootstrap correctly (e.g. Memory error)
403403 _PyEvent_Notify (& handle -> thread_is_bootstraped );
404404 }
405405 else {
@@ -432,7 +432,6 @@ force_done(void *arg)
432432 assert (get_thread_handle_state (handle ) == THREAD_HANDLE_STARTING );
433433 _PyEvent_Notify (& handle -> thread_is_exiting );
434434 set_thread_handle_state (handle , THREAD_HANDLE_DONE );
435- _PyEvent_Notify (& handle -> thread_is_bootstraped );
436435 return 0 ;
437436}
438437
You can’t perform that action at this time.
0 commit comments