MCPcopy Index your code
hub / github.com/python/cpython / check_sanitizer

Function check_sanitizer

Lib/test/support/__init__.py:438–472  ·  view source on GitHub ↗

Returns True if Python is compiled with sanitizer support

(*, address=False, memory=False, ub=False, thread=False,
                    function=True)

Source from the content-addressed store, hash-verified

436 return unittest.skipIf(isbuildbot, reason)
437
438def check_sanitizer(*, address=False, memory=False, ub=False, thread=False,
439 function=True):
440 """Returns True if Python is compiled with sanitizer support"""
441 if not (address or memory or ub or thread):
442 raise ValueError('At least one of address, memory, ub or thread must be True')
443
444
445 cflags = sysconfig.get_config_var('CFLAGS') or ''
446 config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
447 memory_sanitizer = (
448 '-fsanitize=memory' in cflags or
449 '--with-memory-sanitizer' in config_args
450 )
451 address_sanitizer = (
452 '-fsanitize=address' in cflags or
453 '--with-address-sanitizer' in config_args
454 )
455 ub_sanitizer = (
456 '-fsanitize=undefined' in cflags or
457 '--with-undefined-behavior-sanitizer' in config_args
458 )
459 thread_sanitizer = (
460 '-fsanitize=thread' in cflags or
461 '--with-thread-sanitizer' in config_args
462 )
463 function_sanitizer = (
464 '-fsanitize=function' in cflags
465 )
466 return (
467 (memory and memory_sanitizer) or
468 (address and address_sanitizer) or
469 (ub and ub_sanitizer) or
470 (thread and thread_sanitizer) or
471 (function and function_sanitizer)
472 )
473
474
475def skip_if_sanitizer(reason=None, *, address=False, memory=False, ub=False, thread=False):

Callers 4

test_idle.pyFile · 0.90
__init__.pyFile · 0.90
skip_if_sanitizerFunction · 0.85
__init__.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…