Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit acffe20

Browse filesBrowse files
[3.13] GH-118943: Fix a race condition when generating jit_stencils.h (GH-119101)
(cherry picked from commit 4702b7b)
1 parent 45fbca9 commit acffe20
Copy full SHA for acffe20

File tree

Expand file treeCollapse file tree

2 files changed

+15
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+15
-7
lines changed
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix a possible race condition affecting parallel builds configured with
2+
``--enable-experimental-jit``, in which compilation errors could be caused
3+
by an incompletely-generated header file.

‎Tools/jit/_targets.py

Copy file name to clipboardExpand all lines: Tools/jit/_targets.py
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,18 @@ def build(
212212
):
213213
return
214214
stencil_groups = asyncio.run(self._build_stencils())
215-
with jit_stencils.open("w") as file:
216-
file.write(digest)
217-
if comment:
218-
file.write(f"// {comment}\n\n")
219-
file.write("")
220-
for line in _writer.dump(stencil_groups):
221-
file.write(f"{line}\n")
215+
jit_stencils_new = out / "jit_stencils.h.new"
216+
try:
217+
with jit_stencils_new.open("w") as file:
218+
file.write(digest)
219+
if comment:
220+
file.write(f"// {comment}\n")
221+
file.write("\n")
222+
for line in _writer.dump(stencil_groups):
223+
file.write(f"{line}\n")
224+
jit_stencils_new.replace(jit_stencils)
225+
finally:
226+
jit_stencils_new.unlink(missing_ok=True)
222227

223228

224229
class _COFF(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.