diff -u python2.7-2.7.18/debian/changelog python2.7-2.7.18/debian/changelog --- python2.7-2.7.18/debian/changelog +++ python2.7-2.7.18/debian/changelog @@ -1,3 +1,11 @@ +python2.7 (2.7.18-13ubuntu3) kinetic; urgency=medium + + * Add d/p/add-optimization-flags-to-cflags.diff: + Add optimization flags to cflags when compiling + C modules. (LP: #2002043) + + -- Ghadi Elie Rahme Fri, 07 Jul 2023 09:40:00 +0000 + python2.7 (2.7.18-13ubuntu2) kinetic; urgency=medium * SECURITY UPDATE: Injection Attack diff -u python2.7-2.7.18/debian/patches/series.in python2.7-2.7.18/debian/patches/series.in --- python2.7-2.7.18/debian/patches/series.in +++ python2.7-2.7.18/debian/patches/series.in @@ -85,3 +85,4 @@ skip-tls1.2-tests.diff issue46811.diff CVE-2015-20107.patch +add-optimization-flags-to-cflags.diff only in patch2: unchanged: --- python2.7-2.7.18.orig/debian/patches/add-optimization-flags-to-cflags.diff +++ python2.7-2.7.18/debian/patches/add-optimization-flags-to-cflags.diff @@ -0,0 +1,35 @@ +Subject: Add optimization to cflags in sysconfig.py when building C modules. + +When compiling C code using python, the resulting binary is not being optimized +properly. Currently this is caused by the 'OPT' variable never being imported or +used in distutils/sysconfig.py and not being appended to the cflags variable. +This patch fixes the issue by importing 'OPT' and appending it to 'cflags'. + +Author: Ghadi Elie Rahme +Date: Thu, 6 Jul 2023 17:50:49 +0300 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/2002043 + +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -184,10 +184,10 @@ + _osx_support.customize_compiler(_config_vars) + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' + +- (cc, cxx, cflags, extra_cflags, basecflags, ++ (cc, cxx, cflags, extra_cflags, basecflags, opt, + ccshared, ldshared, so_ext, ar, ar_flags, + configure_cppflags, configure_cflags, configure_ldflags) = \ +- get_config_vars('CC', 'CXX', 'CFLAGS', 'EXTRA_CFLAGS', 'BASECFLAGS', ++ get_config_vars('CC', 'CXX', 'CFLAGS', 'EXTRA_CFLAGS', 'BASECFLAGS', 'OPT', + 'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS', + 'CONFIGURE_CPPFLAGS', 'CONFIGURE_CFLAGS', 'CONFIGURE_LDFLAGS') + +@@ -218,7 +218,7 @@ + cflags = ' '.join(str(x) for x in (basecflags, os.environ['CFLAGS'], extra_cflags) if x) + ldshared = ldshared + ' ' + os.environ['CFLAGS'] + elif configure_cflags: +- cflags = ' '.join(str(x) for x in (basecflags, configure_cflags, extra_cflags) if x) ++ cflags = ' '.join(str(x) for x in (basecflags, opt ,configure_cflags, extra_cflags) if x) + ldshared = ldshared + ' ' + configure_cflags + if 'CPPFLAGS' in os.environ: + cpp = cpp + ' ' + os.environ['CPPFLAGS']