@@ -69,6 +69,10 @@ class EmptyStruct(ctypes.Structure):
6969 '--with-memory-sanitizer' in _config_args
7070)
7171
72+ ADDRESS_SANITIZER = (
73+ '-fsanitize=address' in _cflags
74+ )
75+
7276# Does io.IOBase finalizer log the exception if the close() method fails?
7377# The exception is ignored silently by default in release build.
7478IOBASE_EMITS_UNRAISABLE = (hasattr (sys , "gettotalrefcount" ) or sys .flags .dev_mode )
@@ -1539,7 +1543,7 @@ def test_truncate_on_read_only(self):
15391543class CBufferedReaderTest (BufferedReaderTest , SizeofTest ):
15401544 tp = io .BufferedReader
15411545
1542- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
1546+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
15431547 "instead of returning NULL for malloc failure." )
15441548 def test_constructor (self ):
15451549 BufferedReaderTest .test_constructor (self )
@@ -1888,7 +1892,7 @@ def test_slow_close_from_thread(self):
18881892class CBufferedWriterTest (BufferedWriterTest , SizeofTest ):
18891893 tp = io .BufferedWriter
18901894
1891- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
1895+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
18921896 "instead of returning NULL for malloc failure." )
18931897 def test_constructor (self ):
18941898 BufferedWriterTest .test_constructor (self )
@@ -2387,7 +2391,7 @@ def test_interleaved_readline_write(self):
23872391class CBufferedRandomTest (BufferedRandomTest , SizeofTest ):
23882392 tp = io .BufferedRandom
23892393
2390- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
2394+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
23912395 "instead of returning NULL for malloc failure." )
23922396 def test_constructor (self ):
23932397 BufferedRandomTest .test_constructor (self )
0 commit comments