@@ -73,6 +73,10 @@ class EmptyStruct(ctypes.Structure):
73
73
'--with-memory-sanitizer' in _config_args
74
74
)
75
75
76
+ ADDRESS_SANITIZER = (
77
+ '-fsanitize=address' in _cflags
78
+ )
79
+
76
80
# Does io.IOBase finalizer log the exception if the close() method fails?
77
81
# The exception is ignored silently by default in release build.
78
82
IOBASE_EMITS_UNRAISABLE = (hasattr (sys , "gettotalrefcount" ) or sys .flags .dev_mode )
@@ -1546,7 +1550,7 @@ def test_truncate_on_read_only(self):
1546
1550
class CBufferedReaderTest (BufferedReaderTest , SizeofTest ):
1547
1551
tp = io .BufferedReader
1548
1552
1549
- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
1553
+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
1550
1554
"instead of returning NULL for malloc failure." )
1551
1555
def test_constructor (self ):
1552
1556
BufferedReaderTest .test_constructor (self )
@@ -1911,7 +1915,7 @@ def test_slow_close_from_thread(self):
1911
1915
class CBufferedWriterTest (BufferedWriterTest , SizeofTest ):
1912
1916
tp = io .BufferedWriter
1913
1917
1914
- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
1918
+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
1915
1919
"instead of returning NULL for malloc failure." )
1916
1920
def test_constructor (self ):
1917
1921
BufferedWriterTest .test_constructor (self )
@@ -2410,7 +2414,7 @@ def test_interleaved_readline_write(self):
2410
2414
class CBufferedRandomTest (BufferedRandomTest , SizeofTest ):
2411
2415
tp = io .BufferedRandom
2412
2416
2413
- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
2417
+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
2414
2418
"instead of returning NULL for malloc failure." )
2415
2419
def test_constructor (self ):
2416
2420
BufferedRandomTest .test_constructor (self )
0 commit comments