Skip to content

Commit cb57a52

Browse files
GH-118487: Add Black to .pre-commit-config.yaml for JIT files (GH-118537)
1 parent dd8f05f commit cb57a52

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.pre-commit-config.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ repos:
1111
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]
1212
files: ^Tools/clinic/|Lib/test/test_clinic.py
1313

14+
- repo: https://github.com/psf/black-pre-commit-mirror
15+
rev: 24.4.2
16+
hooks:
17+
- id: black
18+
name: Run Black on Tools/jit/
19+
files: ^Tools/jit/
20+
language_version: python3.12
21+
1422
- repo: https://github.com/pre-commit/pre-commit-hooks
1523
rev: v4.5.0
1624
hooks:

Tools/jit/_targets.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,20 @@ async def _compile(
154154
args_ll = args + [
155155
# -fomit-frame-pointer is necessary because the GHC calling
156156
# convention uses RBP to pass arguments:
157-
"-S", "-emit-llvm", "-fomit-frame-pointer", "-o", f"{ll}", f"{c}"
157+
"-S",
158+
"-emit-llvm",
159+
"-fomit-frame-pointer",
160+
"-o",
161+
f"{ll}",
162+
f"{c}",
158163
]
159164
await _llvm.run("clang", args_ll, echo=self.verbose)
160165
ir = ll.read_text()
161166
# This handles declarations, definitions, and calls to named symbols
162167
# starting with "_JIT_":
163-
ir = re.sub(r"(((noalias|nonnull|noundef) )*ptr @_JIT_\w+\()", r"ghccc \1", ir)
168+
ir = re.sub(
169+
r"(((noalias|nonnull|noundef) )*ptr @_JIT_\w+\()", r"ghccc \1", ir
170+
)
164171
# This handles calls to anonymous callees, since anything with
165172
# "musttail" needs to use the same calling convention:
166173
ir = ir.replace("musttail call", "musttail call ghccc")

0 commit comments

Comments
 (0)