Skip to content

Commit a610414

Browse files
committed
Set _LLVM_VERSION as default value for Target.llvm_version
1 parent d67d191 commit a610414

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Tools/jit/_llvm.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,25 @@ async def _find_tool(tool: str, llvm_version: str, *, echo: bool = False) -> str
9696

9797

9898
async def maybe_run(
99-
tool: str, args: typing.Iterable[str], echo: bool = False, llvm_version: str = ""
99+
tool: str,
100+
args: typing.Iterable[str],
101+
echo: bool = False,
102+
llvm_version: str = _LLVM_VERSION,
100103
) -> str | None:
101104
"""Run an LLVM tool if it can be found. Otherwise, return None."""
102105

103-
if not llvm_version:
104-
llvm_version = _LLVM_VERSION
105-
106106
path = await _find_tool(tool, llvm_version, echo=echo)
107107
return path and await _run(path, args, echo=echo)
108108

109109

110110
async def run(
111-
tool: str, args: typing.Iterable[str], echo: bool = False, llvm_version: str = ""
111+
tool: str,
112+
args: typing.Iterable[str],
113+
echo: bool = False,
114+
llvm_version: str = _LLVM_VERSION,
112115
) -> str:
113116
"""Run an LLVM tool if it can be found. Otherwise, raise RuntimeError."""
114117

115-
if not llvm_version:
116-
llvm_version = _LLVM_VERSION
117-
118118
output = await maybe_run(tool, args, echo=echo, llvm_version=llvm_version)
119119
if output is None:
120120
raise RuntimeError(f"Can't find {tool}-{llvm_version}!")

Tools/jit/_targets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class _Target(typing.Generic[_S, _R]):
5050
debug: bool = False
5151
verbose: bool = False
5252
cflags: str = ""
53-
llvm_version: str = ""
53+
llvm_version: str = _llvm._LLVM_VERSION
5454
known_symbols: dict[str, int] = dataclasses.field(default_factory=dict)
5555
pyconfig_dir: pathlib.Path = pathlib.Path.cwd().resolve()
5656

0 commit comments

Comments
 (0)