From f4166d9817bcdaf8c732c4dd2157664b4f5bbe4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20D=C3=B6ring?= <30527984+radoering@users.noreply.github.com> Date: Fri, 19 Jun 2026 10:01:49 +0200 Subject: [PATCH] perf: add an early return when there are no optimization levels to compile bytecode for --- src/installer/destinations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/installer/destinations.py b/src/installer/destinations.py index ed5d07a..d948356 100644 --- a/src/installer/destinations.py +++ b/src/installer/destinations.py @@ -255,7 +255,10 @@ def write_script( def _compile_bytecode(self, scheme: Scheme, record: RecordEntry) -> None: """Compile bytecode for a single .py file.""" - if scheme not in ("purelib", "platlib"): + if not self.bytecode_optimization_levels or scheme not in ( + "purelib", + "platlib", + ): return import compileall