File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1039,6 +1039,22 @@ def checker():
10391039 self .assertEqual (threading .gettrace (), old_trace )
10401040 self .assertEqual (sys .gettrace (), old_trace )
10411041
1042+ @unittest .skipUnless (support .Py_GIL_DISABLED , "only meaningful under free-threading" )
1043+ def test_settrace_all_threads_race (self ):
1044+ # GH-132296: settrace_all_threads() could be racy on the free-threaded build
1045+ #if the threads were concurrently deleted.
1046+ def dummy (* args ):
1047+ pass
1048+
1049+ def do_settrace ():
1050+ threading .settrace_all_threads (dummy )
1051+
1052+ with threading_helper .catch_threading_exception () as cm :
1053+ with threading_helper .start_threads ((threading .Thread (target = do_settrace ) for _ in range (8 ))):
1054+ pass
1055+
1056+ self .assertIsNone (cm .exc_value )
1057+
10421058 def test_getprofile (self ):
10431059 def fn (* args ): pass
10441060 old_profile = threading .getprofile ()
You can’t perform that action at this time.
0 commit comments