Skip to content

Commit

Permalink
Merge branch 'main' into named_expr_checks
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel authored Aug 6, 2024
2 parents 164c612 + 44659d3 commit a5f61e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix a possible race condition affecting parallel builds configured with
``--enable-experimental-jit``, in which :exc:`FileNotFoundError` could be caused by
another process already moving ``jit_stencils.h.new`` to ``jit_stencils.h``.
7 changes: 6 additions & 1 deletion Tools/jit/_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@ def build(
file.write("\n")
for line in _writer.dump(stencil_groups):
file.write(f"{line}\n")
jit_stencils_new.replace(jit_stencils)
try:
jit_stencils_new.replace(jit_stencils)
except FileNotFoundError:
# another process probably already moved the file
if not jit_stencils.is_file():
raise
finally:
jit_stencils_new.unlink(missing_ok=True)

Expand Down

0 comments on commit a5f61e5

Please sign in to comment.