https://github.com/python/cpython/commit/a6ad448237755cfd2d52d6002f7c38f5f67b5ab2
commit: a6ad448237755cfd2d52d6002f7c38f5f67b5ab2
branch: main
author: Hugo van Kemenade <[email protected]>
committer: hugovk <[email protected]>
date: 2026-09-21T15:54:25+03:00
summary:

Skip optimisations to speedup `test_freeze` rebuild (#157264)

files:
M Tools/freeze/test/freeze.py

diff --git a/Tools/freeze/test/freeze.py b/Tools/freeze/test/freeze.py
index 1e3687dbb807a69..f4330076f225b52 100644
--- a/Tools/freeze/test/freeze.py
+++ b/Tools/freeze/test/freeze.py
@@ -64,6 +64,16 @@ def find_opt(args, name):
     return -1
 
 
+def remove_opt(args: list[str], name: str) -> None:
+    opt = f'--{name}'
+    optstart = f'{opt}='
+    args[:] = [
+        arg
+        for arg in args
+        if arg != opt and not arg.startswith(optstart)
+    ]
+
+
 def ensure_opt(args, name, value):
     opt = f'--{name}'
     pos = find_opt(args, name)
@@ -128,6 +138,10 @@ def prepare(script=None, outdir=None):
     # Run configure.
     print(f'configuring python in {builddir}...')
     config_args = shlex.split(sysconfig.get_config_var('CONFIG_ARGS') or '')
+    # Optimisations such as LTO and PGO only slow down the build of this
+    # throwaway interpreter without affecting what the test checks.
+    remove_opt(config_args, 'enable-optimizations')
+    remove_opt(config_args, 'with-lto')
     cmd = [os.path.join(srcdir, 'configure'), *config_args]
     ensure_opt(cmd, 'cache-file', os.path.join(outdir, 'python-config.cache'))
     prefix = os.path.join(outdir, 'python-installation')

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to