mirror of
https://github.com/python/cpython
synced 2026-09-26 16:21:04 +03:00
[3.13] GH-118943: Fix a race condition when generating jit_stencils.h (GH-119101)
(cherry picked from commit 4702b7b5bdc07d046576b4126cf4e4f5f7145abb)
This commit is contained in:
parent
45fbca983c
commit
acffe20683
2 changed files with 15 additions and 7 deletions
|
|
@ -0,0 +1,3 @@
|
||||||
|
Fix a possible race condition affecting parallel builds configured with
|
||||||
|
``--enable-experimental-jit``, in which compilation errors could be caused
|
||||||
|
by an incompletely-generated header file.
|
||||||
|
|
@ -212,13 +212,18 @@ class _Target(typing.Generic[_S, _R]):
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
stencil_groups = asyncio.run(self._build_stencils())
|
stencil_groups = asyncio.run(self._build_stencils())
|
||||||
with jit_stencils.open("w") as file:
|
jit_stencils_new = out / "jit_stencils.h.new"
|
||||||
|
try:
|
||||||
|
with jit_stencils_new.open("w") as file:
|
||||||
file.write(digest)
|
file.write(digest)
|
||||||
if comment:
|
if comment:
|
||||||
file.write(f"// {comment}\n\n")
|
file.write(f"// {comment}\n")
|
||||||
file.write("")
|
file.write("\n")
|
||||||
for line in _writer.dump(stencil_groups):
|
for line in _writer.dump(stencil_groups):
|
||||||
file.write(f"{line}\n")
|
file.write(f"{line}\n")
|
||||||
|
jit_stencils_new.replace(jit_stencils)
|
||||||
|
finally:
|
||||||
|
jit_stencils_new.unlink(missing_ok=True)
|
||||||
|
|
||||||
|
|
||||||
class _COFF(
|
class _COFF(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue