mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-45196: prevent unittest crash on address sanitizer builds (GH-28331)
This commit is contained in:
parent
024fda47d4
commit
b668cdfa09
2 changed files with 20 additions and 3 deletions
|
@ -73,6 +73,10 @@ MEMORY_SANITIZER = (
|
|||
'--with-memory-sanitizer' in _config_args
|
||||
)
|
||||
|
||||
ADDRESS_SANITIZER = (
|
||||
'-fsanitize=address' in _cflags
|
||||
)
|
||||
|
||||
# Does io.IOBase finalizer log the exception if the close() method fails?
|
||||
# The exception is ignored silently by default in release build.
|
||||
IOBASE_EMITS_UNRAISABLE = (hasattr(sys, "gettotalrefcount") or sys.flags.dev_mode)
|
||||
|
@ -1546,7 +1550,7 @@ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
|
|||
class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
|
||||
tp = io.BufferedReader
|
||||
|
||||
@unittest.skipIf(MEMORY_SANITIZER, "MSan defaults to crashing "
|
||||
@unittest.skipIf(MEMORY_SANITIZER or ADDRESS_SANITIZER, "sanitizer defaults to crashing "
|
||||
"instead of returning NULL for malloc failure.")
|
||||
def test_constructor(self):
|
||||
BufferedReaderTest.test_constructor(self)
|
||||
|
@ -1911,7 +1915,7 @@ class BufferedWriterTest(unittest.TestCase, CommonBufferedTests):
|
|||
class CBufferedWriterTest(BufferedWriterTest, SizeofTest):
|
||||
tp = io.BufferedWriter
|
||||
|
||||
@unittest.skipIf(MEMORY_SANITIZER, "MSan defaults to crashing "
|
||||
@unittest.skipIf(MEMORY_SANITIZER or ADDRESS_SANITIZER, "sanitizer defaults to crashing "
|
||||
"instead of returning NULL for malloc failure.")
|
||||
def test_constructor(self):
|
||||
BufferedWriterTest.test_constructor(self)
|
||||
|
@ -2410,7 +2414,7 @@ class BufferedRandomTest(BufferedReaderTest, BufferedWriterTest):
|
|||
class CBufferedRandomTest(BufferedRandomTest, SizeofTest):
|
||||
tp = io.BufferedRandom
|
||||
|
||||
@unittest.skipIf(MEMORY_SANITIZER, "MSan defaults to crashing "
|
||||
@unittest.skipIf(MEMORY_SANITIZER or ADDRESS_SANITIZER, "sanitizer defaults to crashing "
|
||||
"instead of returning NULL for malloc failure.")
|
||||
def test_constructor(self):
|
||||
BufferedRandomTest.test_constructor(self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue