[New-bugs-announce] [issue37097] python_is_optimized() false negatives

Jeroen Demeyer report at bugs.python.org
Thu May 30 03:43:48 EDT 2019


New submission from Jeroen Demeyer <J.Demeyer at UGent.be>:

The function python_is_optimized() in Lib/test/support.py:

def python_is_optimized():
    """Find if Python was built with optimizations."""
    cflags = sysconfig.get_config_var('PY_CFLAGS') or ''
    final_opt = ""
    for opt in cflags.split():
        if opt.startswith('-O'):
            final_opt = opt
    return final_opt not in ('', '-O0', '-Og')

However, it seems that the *default* (when no special CFLAGS are configured) is -O3. My Python build is done with this default -O3 but python_is_optimized() returns False. This is the reason why I didn't catch the buildbot failure at
https://github.com/python/cpython/pull/13185#issuecomment-497062965
(this test is only run when python_is_optimized() is True)

----------
components: Tests
messages: 343952
nosy: benjamin.peterson, jdemeyer, petr.viktorin, pitrou
priority: normal
severity: normal
status: open
title: python_is_optimized() false negatives
type: behavior
versions: Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37097>
_______________________________________


More information about the New-bugs-announce mailing list