Skip to content

Commit f1b9c12

Browse files
radoeringgithub-actions[bot]
authored andcommitted
installer: fix optimization level (#7666)
(cherry picked from commit 4dfb894)
1 parent 7b021d4 commit f1b9c12

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/poetry/installation/wheel_installer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def __init__(self, env: Env) -> None:
9494
)
9595

9696
def enable_bytecode_compilation(self, enable: bool = True) -> None:
97-
self._destination.bytecode_optimization_levels = (1,) if enable else ()
97+
self._destination.bytecode_optimization_levels = (-1,) if enable else ()
9898

9999
def install(self, wheel: Path) -> None:
100100
with WheelFile.open(wheel) as source:

tests/installation/test_wheel_installer.py

+2
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,7 @@ def test_enable_bytecode_compilation(
7777
if compile:
7878
assert cache_dir.exists()
7979
assert list(cache_dir.glob("*.pyc"))
80+
assert not list(cache_dir.glob("*.opt-1.pyc"))
81+
assert not list(cache_dir.glob("*.opt-2.pyc"))
8082
else:
8183
assert not cache_dir.exists()

0 commit comments

Comments
 (0)