@@ -715,13 +715,13 @@ def __del__(self) -> None:
715715 if self .save_thread is not None :
716716 self .save_thread .stop ()
717717
718- def _stop_thread (self ):
718+ def _stop_thread (self ) -> None :
719719 # Used before forking so the thread isn't running at fork
720720 if self .save_thread is not None :
721721 self .save_thread .stop ()
722722 self .save_thread = None
723723
724- def _restart_thread_if_stopped (self ):
724+ def _restart_thread_if_stopped (self ) -> None :
725725 # Start the thread again after it was stopped for forking
726726 if self .save_thread is None and self .using_thread :
727727 self .save_thread = HistorySavingThread (self )
@@ -990,7 +990,8 @@ def store_inputs(
990990 if len (self .db_input_cache ) >= self .db_cache_size :
991991 if self .using_thread :
992992 self ._restart_thread_if_stopped ()
993- self .save_flag .set ()
993+ if self .save_flag is not None :
994+ self .save_flag .set ()
994995
995996 # update the auto _i variables
996997 self ._iii = self ._ii
@@ -1024,7 +1025,8 @@ def store_output(self, line_num: int) -> None:
10241025 self .db_output_cache .append ((line_num , output ))
10251026 if self .db_cache_size <= 1 and self .using_thread :
10261027 self ._restart_thread_if_stopped ()
1027- self .save_flag .set ()
1028+ if self .save_flag is not None :
1029+ self .save_flag .set ()
10281030
10291031 def _writeout_input_cache (self , conn : sqlite3 .Connection ) -> None :
10301032 with conn :
0 commit comments