This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: python_is_optimized() false negatives
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, jdemeyer, petr.viktorin, pitrou
Priority: normal Keywords:

Created on 2019-05-30 07:43 by jdemeyer, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg343952 - (view) Author: Jeroen Demeyer (jdemeyer) * (Python triager) Date: 2019-05-30 07:43
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)
msg346357 - (view) Author: Jeroen Demeyer (jdemeyer) * (Python triager) Date: 2019-06-24 08:24
Never mind, I probably tested wrong here.
History
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81278
2019-06-24 08:24:38jdemeyersetstatus: open -> closed
resolution: works for me
messages: + msg346357

stage: resolved
2019-05-30 07:43:48jdemeyercreate