Author vstinner
Recipients vstinner
Date 2019-03-08.12:23:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1552047825.38.0.133209322208.issue36235@roundup.psfhosted.org>
In-reply-to
Content
When a C extension is built by distutils, distutils.sysconfig.customize_compiler() is used to configure compiler flags. Extract of the code:

    (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
        get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
                        'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')

    ...
    if 'CFLAGS' in os.environ:
        cflags = opt + ' ' + os.environ['CFLAGS']
        ldshared = ldshared + ' ' + os.environ['CFLAGS']
    if 'CPPFLAGS' in os.environ:
        cpp = cpp + ' ' + os.environ['CPPFLAGS']
        cflags = cflags + ' ' + os.environ['CPPFLAGS']
        ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
    ...

If the CFLAGS environment variable is set, the 'CFLAGS' configuration variable is overriden with the 'OPT' configuration variable: cflags = opt + ...

This bug has been fixed since 2013 in Fedora and RHEL by this patch:
https://src.fedoraproject.org/rpms/python2/blob/master/f/00168-distutils-cflags.patch

RHEL bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=849994

I converted that patch to a pull request.
History
Date User Action Args
2019-03-08 12:23:45vstinnersetrecipients: + vstinner
2019-03-08 12:23:45vstinnersetmessageid: <1552047825.38.0.133209322208.issue36235@roundup.psfhosted.org>
2019-03-08 12:23:45vstinnerlinkissue36235 messages
2019-03-08 12:23:45vstinnercreate