Skip to content

Commit 43a2a37

Browse files
[3.13] GH-130396: Treat clang -Og as optimized for gdb tests (GH-130550) (#130572)
GH-130396: Treat clang -Og as optimized for gdb tests (GH-130550) (cherry picked from commit 129db32) Co-authored-by: Mark Shannon <mark@hotpy.org>
1 parent 2ab7e11 commit 43a2a37

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/support/__init__.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -833,15 +833,18 @@ def gc_threshold(*args):
833833
finally:
834834
gc.set_threshold(*old_threshold)
835835

836-
837836
def python_is_optimized():
838837
"""Find if Python was built with optimizations."""
839838
cflags = sysconfig.get_config_var('PY_CFLAGS') or ''
840839
final_opt = ""
841840
for opt in cflags.split():
842841
if opt.startswith('-O'):
843842
final_opt = opt
844-
return final_opt not in ('', '-O0', '-Og')
843+
if sysconfig.get_config_var("CC") == "gcc":
844+
non_opts = ('', '-O0', '-Og')
845+
else:
846+
non_opts = ('', '-O0')
847+
return final_opt not in non_opts
845848

846849

847850
def check_cflags_pgo():

0 commit comments

Comments
 (0)