Skip to content

Commit 9262e1d

Browse files
Ensure new_cmd is always defined (#20510)
Fix build when `MYPYC_NO_EXTRA_FLAGS` env variable is defined.
1 parent 525e54a commit 9262e1d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

mypyc/build_setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040

4141

4242
def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
43+
new_cmd = list(cmd)
4344
if PYODIDE:
44-
new_cmd = list(cmd)
4545
for argument in reversed(new_cmd):
4646
if not str(argument).endswith(".c"):
4747
continue
@@ -50,7 +50,6 @@ def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
5050
elif not NO_EXTRA_FLAGS:
5151
compiler_type: str = self.compiler_type
5252
extra_options = EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT.get(compiler_type, None)
53-
new_cmd = list(cmd)
5453
if X86_64 and extra_options is not None:
5554
# filenames are closer to the end of command line
5655
for argument in reversed(new_cmd):

mypyc/lib-rt/build_setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040

4141

4242
def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
43+
new_cmd = list(cmd)
4344
if PYODIDE:
44-
new_cmd = list(cmd)
4545
for argument in reversed(new_cmd):
4646
if not str(argument).endswith(".c"):
4747
continue
@@ -50,7 +50,6 @@ def spawn(self, cmd, **kwargs) -> None: # type: ignore[no-untyped-def]
5050
elif not NO_EXTRA_FLAGS:
5151
compiler_type: str = self.compiler_type
5252
extra_options = EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT.get(compiler_type, None)
53-
new_cmd = list(cmd)
5453
if X86_64 and extra_options is not None:
5554
# filenames are closer to the end of command line
5655
for argument in reversed(new_cmd):

0 commit comments

Comments
 (0)