@@ -47,6 +47,8 @@ def skip_unless_reliable_fork(test):
47
47
return unittest .skip ("due to known OS bug related to thread+fork" )(test )
48
48
if support .HAVE_ASAN_FORK_BUG :
49
49
return unittest .skip ("libasan has a pthread_create() dead lock related to thread+fork" )(test )
50
+ if support .check_sanitizer (thread = True ):
51
+ return unittest .skip ("TSAN doesn't support threads after fork" )
50
52
return test
51
53
52
54
@@ -384,6 +386,10 @@ def test_finalize_running_thread(self):
384
386
# Issue 1402: the PyGILState_Ensure / _Release functions may be called
385
387
# very late on python exit: on deallocation of a running thread for
386
388
# example.
389
+ if support .check_sanitizer (thread = True ):
390
+ # the thread running `time.sleep(100)` below will still be alive
391
+ # at process exit
392
+ self .skipTest ("TSAN would report thread leak" )
387
393
import_module ("ctypes" )
388
394
389
395
rc , out , err = assert_python_failure ("-c" , """if 1:
@@ -416,6 +422,11 @@ def waitingThread():
416
422
def test_finalize_with_trace (self ):
417
423
# Issue1733757
418
424
# Avoid a deadlock when sys.settrace steps into threading._shutdown
425
+ if support .check_sanitizer (thread = True ):
426
+ # the thread running `time.sleep(2)` below will still be alive
427
+ # at process exit
428
+ self .skipTest ("TSAN would report thread leak" )
429
+
419
430
assert_python_ok ("-c" , """if 1:
420
431
import sys, threading
421
432
@@ -1223,6 +1234,11 @@ def test_4_daemon_threads(self):
1223
1234
# Check that a daemon thread cannot crash the interpreter on shutdown
1224
1235
# by manipulating internal structures that are being disposed of in
1225
1236
# the main thread.
1237
+ if support .check_sanitizer (thread = True ):
1238
+ # some of the threads running `random_io` below will still be alive
1239
+ # at process exit
1240
+ self .skipTest ("TSAN would report thread leak" )
1241
+
1226
1242
script = """if True:
1227
1243
import os
1228
1244
import random
0 commit comments