New submission from Jeroen Demeyer <j.deme...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue37097>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to