mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
bpo-45196: prevent unittest crash on address sanitizer builds (GH-28331)
(cherry picked from commit b668cdfa09
)
Co-authored-by: junyixie <xiejunyi.arch@bytedance.com>
This commit is contained in:
parent
13257d9fca
commit
9ccdc90488
2 changed files with 20 additions and 3 deletions
|
@ -40,6 +40,17 @@ from test.support import (import_fresh_module, TestFailed,
|
|||
import random
|
||||
import inspect
|
||||
import threading
|
||||
import sysconfig
|
||||
_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
|
||||
)
|
||||
|
||||
ADDRESS_SANITIZER = (
|
||||
'-fsanitize=address' in _cflags
|
||||
)
|
||||
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
|
@ -5486,6 +5497,8 @@ class CWhitebox(unittest.TestCase):
|
|||
# Issue 41540:
|
||||
@unittest.skipIf(sys.platform.startswith("aix"),
|
||||
"AIX: default ulimit: test is flaky because of extreme over-allocation")
|
||||
@unittest.skipIf(MEMORY_SANITIZER or ADDRESS_SANITIZER, "sanitizer defaults to crashing "
|
||||
"instead of returning NULL for malloc failure.")
|
||||
def test_maxcontext_exact_arith(self):
|
||||
|
||||
# Make sure that exact operations do not raise MemoryError due
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue