From 40b2e6b47612dcf5b81aa8064a0f86247bc69b57 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 26 Feb 2025 12:38:21 +0100 Subject: [PATCH] [3.12] GH-130396: Treat clang -Og as optimized for gdb tests (GH-130550) (GH-130573) GH-130396: Treat clang -Og as optimized for gdb tests (GH-130550) (cherry picked from commit 129db32d6f2d7f450d2741da6a222c18e458c61b) (cherry picked from commit c4aeb4c444237dd3a6571d23c9dcad91f7987c1d) Co-authored-by: Victor Stinner Co-authored-by: Mark Shannon --- Lib/test/support/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 059542c24335a2..26cd880d227855 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -768,7 +768,11 @@ def python_is_optimized(): for opt in cflags.split(): if opt.startswith('-O'): final_opt = opt - return final_opt not in ('', '-O0', '-Og') + if sysconfig.get_config_var("CC") == "gcc": + non_opts = ('', '-O0', '-Og') + else: + non_opts = ('', '-O0') + return final_opt not in non_opts def check_cflags_pgo():