|
34 | 34 | import locale |
35 | 35 | from test.support import (run_unittest, run_doctest, is_resource_enabled, |
36 | 36 | requires_IEEE_754, requires_docstrings, |
37 | | - requires_legacy_unicode_capi) |
| 37 | + requires_legacy_unicode_capi, check_sanitizer) |
38 | 38 | from test.support import (TestFailed, |
39 | 39 | run_with_locale, cpython_only, |
40 | 40 | darwin_malloc_err_warning) |
|
43 | 43 | import random |
44 | 44 | import inspect |
45 | 45 | import threading |
46 | | -import sysconfig |
47 | | -_cflags = sysconfig.get_config_var('CFLAGS') or '' |
48 | | -_config_args = sysconfig.get_config_var('CONFIG_ARGS') or '' |
49 | | -MEMORY_SANITIZER = ( |
50 | | - '-fsanitize=memory' in _cflags or |
51 | | - '--with-memory-sanitizer' in _config_args |
52 | | -) |
53 | | - |
54 | | -ADDRESS_SANITIZER = ( |
55 | | - '-fsanitize=address' in _cflags |
56 | | -) |
57 | 46 |
|
58 | 47 |
|
59 | 48 | if sys.platform == 'darwin': |
@@ -5518,7 +5507,8 @@ def __abs__(self): |
5518 | 5507 | # Issue 41540: |
5519 | 5508 | @unittest.skipIf(sys.platform.startswith("aix"), |
5520 | 5509 | "AIX: default ulimit: test is flaky because of extreme over-allocation") |
5521 | | - @unittest.skipIf(MEMORY_SANITIZER or ADDRESS_SANITIZER, "sanitizer defaults to crashing " |
| 5510 | + @unittest.skipIf(check_sanitizer(address=True, memory=True), |
| 5511 | + "ASAN/MSAN sanitizer defaults to crashing " |
5522 | 5512 | "instead of returning NULL for malloc failure.") |
5523 | 5513 | def test_maxcontext_exact_arith(self): |
5524 | 5514 |
|
|
0 commit comments