Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
--- /dev/null
+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``.
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)