https://github.com/python/cpython/commit/e3a433c85f051b2e2be1e2a4de71dc7870a072a7 commit: e3a433c85f051b2e2be1e2a4de71dc7870a072a7 branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: vstinner <[email protected]> date: 2026-11-10T15:30:13Z summary:
[3.14] gh-111178: Set function=False by default in support.check_sanitizer() (GH-161640) (GH-161713) (#161720) [3.15] gh-111178: Set function=False by default in support.check_sanitizer() (GH-161640) (GH-161713) gh-111178: Set function=False by default in support.check_sanitizer() (GH-161640) Update also libregrtest.utils to detect function sanitizer (-fsanitize=function). (cherry picked from commit 39d10e306f4c59514ba2f26dbfa4ac774fb63b42) (cherry picked from commit 4e10d4fef5c073faaaf04ce5e03749a5dbe7716b) Co-authored-by: Victor Stinner <[email protected]> files: M Lib/test/libregrtest/utils.py M Lib/test/support/__init__.py diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py index 45e133b240c649..75ce76b5da0312 100644 --- a/Lib/test/libregrtest/utils.py +++ b/Lib/test/libregrtest/utils.py @@ -384,6 +384,9 @@ def get_build_info(): # --with-thread-sanitizer if support.check_sanitizer(thread=True): sanitizers.append("TSAN") + # --with-thread-sanitizer + if support.check_sanitizer(function=True): + sanitizers.append("fsanitize=function") if sanitizers: build.append('+'.join(sanitizers)) @@ -672,6 +675,7 @@ def display_header(use_resources: dict[str, str | None], msan = support.check_sanitizer(memory=True) ubsan = support.check_sanitizer(ub=True) tsan = support.check_sanitizer(thread=True) + function_san = support.check_sanitizer(function=True) sanitizers = [] if asan: sanitizers.append("address") @@ -681,12 +685,14 @@ def display_header(use_resources: dict[str, str | None], sanitizers.append("undefined behavior") if tsan: sanitizers.append("thread") + if function_san: + sanitizers.append("function") if sanitizers: print(f"== sanitizers: {', '.join(sanitizers)}") for sanitizer, env_var in ( (asan, "ASAN_OPTIONS"), (msan, "MSAN_OPTIONS"), - (ubsan, "UBSAN_OPTIONS"), + (ubsan or function_san, "UBSAN_OPTIONS"), (tsan, "TSAN_OPTIONS"), ): options= os.environ.get(env_var) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 5080e0153e0455..238316dffb2830 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -437,10 +437,11 @@ def skip_if_buildbot(reason=None): return unittest.skipIf(isbuildbot, reason) def check_sanitizer(*, address=False, memory=False, ub=False, thread=False, - function=True): + function=False): """Returns True if Python is compiled with sanitizer support""" - if not (address or memory or ub or thread): - raise ValueError('At least one of address, memory, ub or thread must be True') + if not (address or memory or ub or thread or function): + raise ValueError('At least one of address, memory, ub, ' + 'thread or function must be True') cflags = sysconfig.get_config_var('CFLAGS') or '' @@ -485,11 +486,13 @@ def configured_with_sanitizer(name): ) -def skip_if_sanitizer(reason=None, *, address=False, memory=False, ub=False, thread=False): +def skip_if_sanitizer(reason=None, *, address=False, memory=False, ub=False, + thread=False, function=False): """Decorator raising SkipTest if running with a sanitizer active.""" if not reason: reason = 'not working with sanitizers active' - skip = check_sanitizer(address=address, memory=memory, ub=ub, thread=thread) + skip = check_sanitizer(address=address, memory=memory, ub=ub, + thread=thread, function=function) return unittest.skipIf(skip, reason) # gh-89363: True if fork() can hang if Python is built with Address Sanitizer _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
