@@ -69,6 +69,10 @@ class EmptyStruct(ctypes.Structure):
69
69
'--with-memory-sanitizer' in _config_args
70
70
)
71
71
72
+ ADDRESS_SANITIZER = (
73
+ '-fsanitize=address' in _cflags
74
+ )
75
+
72
76
# Does io.IOBase finalizer log the exception if the close() method fails?
73
77
# The exception is ignored silently by default in release build.
74
78
IOBASE_EMITS_UNRAISABLE = (hasattr (sys , "gettotalrefcount" ) or sys .flags .dev_mode )
@@ -1539,7 +1543,7 @@ def test_truncate_on_read_only(self):
1539
1543
class CBufferedReaderTest (BufferedReaderTest , SizeofTest ):
1540
1544
tp = io .BufferedReader
1541
1545
1542
- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
1546
+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
1543
1547
"instead of returning NULL for malloc failure." )
1544
1548
def test_constructor (self ):
1545
1549
BufferedReaderTest .test_constructor (self )
@@ -1888,7 +1892,7 @@ def test_slow_close_from_thread(self):
1888
1892
class CBufferedWriterTest (BufferedWriterTest , SizeofTest ):
1889
1893
tp = io .BufferedWriter
1890
1894
1891
- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
1895
+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
1892
1896
"instead of returning NULL for malloc failure." )
1893
1897
def test_constructor (self ):
1894
1898
BufferedWriterTest .test_constructor (self )
@@ -2387,7 +2391,7 @@ def test_interleaved_readline_write(self):
2387
2391
class CBufferedRandomTest (BufferedRandomTest , SizeofTest ):
2388
2392
tp = io .BufferedRandom
2389
2393
2390
- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
2394
+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
2391
2395
"instead of returning NULL for malloc failure." )
2392
2396
def test_constructor (self ):
2393
2397
BufferedRandomTest .test_constructor (self )
0 commit comments