File tree Expand file tree Collapse file tree
Lib/test/test_free_threading Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,24 +38,28 @@ def shutdown_worker():
3838 pass
3939
4040 def startup_worker ():
41- handles = []
4241 for _ in range (ITERATIONS ):
4342 handle = _thread .start_joinable_thread (
4443 lambda : None ,
4544 daemon = False ,
4645 )
47- handles .append (handle )
48- for handle in handles :
4946 handle .join ()
5047
48+ # The workers must be daemon threads so _thread._shutdown() ignores them
49+ # and only scans the non-daemon handles created by startup_worker().
5150 workers = [
52- threading .Thread (target = shutdown_worker , daemon = True ),
53- * [threading .Thread (
54- target = startup_worker , daemon = True ) for _ in range (STARTUP_THREADS )],
51+ threading .Thread (target = shutdown_worker , daemon = True ),
52+ * [
53+ threading .Thread (target = startup_worker , daemon = True )
54+ for _ in range (STARTUP_THREADS )
55+ ],
5556 ]
5657
57- with threading_helper .start_threads (workers ):
58- pass
58+ with threading_helper .catch_threading_exception () as cm :
59+ with threading_helper .start_threads (workers ):
60+ pass
61+ if cm .exc_value is not None :
62+ raise cm .exc_value
5963
6064if __name__ == "__main__" :
6165 unittest .main ()
You can’t perform that action at this time.
0 commit comments