summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorMiro HronĨok <miro@hroncok.cz>2024-08-05 23:10:40 (GMT)
committerGitHub <noreply@github.com>2024-08-05 23:10:40 (GMT)
commit44659d392751f0161a0f958fec39ad013da45427 (patch)
tree9c55ddf3665b638cb01e49351b34179155d507c6 /Tools
parent5bd72912a1a85be96092de302608a4298741c6cd (diff)
downloadcpython-44659d392751f0161a0f958fec39ad013da45427.zip
cpython-44659d392751f0161a0f958fec39ad013da45427.tar.gz
cpython-44659d392751f0161a0f958fec39ad013da45427.tar.bz2
GH-118943: Handle races when moving jit_stencils.h (GH-120690)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Diffstat (limited to 'Tools')
-rw-r--r--Tools/jit/_targets.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py
index 5604c42..73d10a1 100644
--- a/Tools/jit/_targets.py
+++ b/Tools/jit/_targets.py
@@ -221,7 +221,12 @@ class _Target(typing.Generic[_S, _R]):
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)