@@ -950,7 +950,9 @@ def start(self, timeout=5.0):
950950 timeout (float): How long we wait for the thread start event.
951951 5.0 sec by default.
952952 """
953- _start_new_thread = getattr (threading , "_start_new_thread" , None )
953+ _active_limbo_lock = threading ._active_limbo_lock
954+ _limbo = threading ._limbo
955+ _start_new_thread = threading ._start_new_thread
954956
955957 # Python2 uses name mangling
956958 if hasattr (self , "_Thread__initialized" ):
@@ -966,18 +968,6 @@ def start(self, timeout=5.0):
966968 if self ._started .is_set ():
967969 raise RuntimeError ("threads can only be started once" )
968970
969- # Python 3.14+ no longer exposes threading._start_new_thread.
970- # In that case, defer to Thread.start() to keep internal join handles valid.
971- if _start_new_thread is None :
972- super (CustomThread , self ).start ()
973- self ._started .wait (timeout )
974- if not self ._started .is_set ():
975- raise RuntimeError ("can't start new thread" )
976- return
977-
978- _active_limbo_lock = threading ._active_limbo_lock
979- _limbo = threading ._limbo
980-
981971 with _active_limbo_lock :
982972 _limbo [self ] = self
983973 try :
@@ -1503,19 +1493,11 @@ def get_row(widths, values, spad=" ", lpad=""):
15031493
15041494def prints (objects , sep = ' ' , end = '\n ' ):
15051495 with open (RESULT_FILE , 'a' ) as f :
1506- stdout_ok = True
1507- try :
1508- print (objects , sep = sep , end = end , file = sys .stdout )
1509- except (OSError , ValueError ):
1510- stdout_ok = False
1496+ print (objects , sep = sep , end = end , file = sys .stdout )
15111497 if end == "\r " :
15121498 end = "\n " # easier to read with \n in a log file
15131499 print (objects , sep = sep , end = end , file = f )
1514- if stdout_ok :
1515- try :
1516- sys .stdout .flush ()
1517- except (OSError , ValueError ):
1518- pass
1500+ sys .stdout .flush ()
15191501 f .flush ()
15201502
15211503
0 commit comments