import random
import signal
import sys
+import sysconfig
import threading
import time
import unittest
class EmptyStruct(ctypes.Structure):
pass
+_cflags = sysconfig.get_config_var('CFLAGS') or ''
+_config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
+MEMORY_SANITIZER = (
+ '-fsanitize=memory' in _cflags or
+ '--with-memory-sanitizer' in _config_args
+)
+
def _default_chunk_size():
"""Get the default TextIOWrapper chunk size"""
with open(__file__, "r", encoding="latin-1") as f:
class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
tp = io.BufferedReader
+ @unittest.skipIf(MEMORY_SANITIZER, "MSan defaults to crashing "
+ "instead of returning NULL for malloc failure.")
def test_constructor(self):
BufferedReaderTest.test_constructor(self)
# The allocation can succeed on 32-bit builds, e.g. with more
class CBufferedWriterTest(BufferedWriterTest, SizeofTest):
tp = io.BufferedWriter
+ @unittest.skipIf(MEMORY_SANITIZER, "MSan defaults to crashing "
+ "instead of returning NULL for malloc failure.")
def test_constructor(self):
BufferedWriterTest.test_constructor(self)
# The allocation can succeed on 32-bit builds, e.g. with more
class CBufferedRandomTest(BufferedRandomTest, SizeofTest):
tp = io.BufferedRandom
+ @unittest.skipIf(MEMORY_SANITIZER, "MSan defaults to crashing "
+ "instead of returning NULL for malloc failure.")
def test_constructor(self):
BufferedRandomTest.test_constructor(self)
# The allocation can succeed on 32-bit builds, e.g. with more