]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] GH-130396: Treat clang -Og as optimized for gdb tests (GH-130550) (#130572)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 26 Feb 2025 11:37:43 +0000 (12:37 +0100)
committerGitHub <noreply@github.com>
Wed, 26 Feb 2025 11:37:43 +0000 (11:37 +0000)
GH-130396: Treat clang -Og as optimized for gdb tests (GH-130550)
(cherry picked from commit 129db32d6f2d7f450d2741da6a222c18e458c61b)

Co-authored-by: Mark Shannon <mark@hotpy.org>
Lib/test/support/__init__.py

index d7fa6096d375c5ccd2e16257a7ec0f7bceb4d5f1..ff450c7f9142afaa136cb54046419f85323b25c6 100644 (file)
@@ -833,7 +833,6 @@ def gc_threshold(*args):
     finally:
         gc.set_threshold(*old_threshold)
 
-
 def python_is_optimized():
     """Find if Python was built with optimizations."""
     cflags = sysconfig.get_config_var('PY_CFLAGS') or ''
@@ -841,7 +840,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():