@@ -73,6 +73,10 @@ class EmptyStruct(ctypes.Structure):
7373 '--with-memory-sanitizer' in _config_args
7474)
7575
76+ ADDRESS_SANITIZER = (
77+ '-fsanitize=address' in _cflags
78+ )
79+
7680# Does io.IOBase finalizer log the exception if the close() method fails?
7781# The exception is ignored silently by default in release build.
7882IOBASE_EMITS_UNRAISABLE = (hasattr (sys , "gettotalrefcount" ) or sys .flags .dev_mode )
@@ -1546,7 +1550,7 @@ def test_truncate_on_read_only(self):
15461550class CBufferedReaderTest (BufferedReaderTest , SizeofTest ):
15471551 tp = io .BufferedReader
15481552
1549- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
1553+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
15501554 "instead of returning NULL for malloc failure." )
15511555 def test_constructor (self ):
15521556 BufferedReaderTest .test_constructor (self )
@@ -1911,7 +1915,7 @@ def test_slow_close_from_thread(self):
19111915class CBufferedWriterTest (BufferedWriterTest , SizeofTest ):
19121916 tp = io .BufferedWriter
19131917
1914- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
1918+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
19151919 "instead of returning NULL for malloc failure." )
19161920 def test_constructor (self ):
19171921 BufferedWriterTest .test_constructor (self )
@@ -2410,7 +2414,7 @@ def test_interleaved_readline_write(self):
24102414class CBufferedRandomTest (BufferedRandomTest , SizeofTest ):
24112415 tp = io .BufferedRandom
24122416
2413- @unittest .skipIf (MEMORY_SANITIZER , "MSan defaults to crashing "
2417+ @unittest .skipIf (MEMORY_SANITIZER or ADDRESS_SANITIZER , "sanitizer defaults to crashing "
24142418 "instead of returning NULL for malloc failure." )
24152419 def test_constructor (self ):
24162420 BufferedRandomTest .test_constructor (self )
0 commit comments