File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change
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.
Original file line number Diff line number Diff line change @@ -212,13 +212,18 @@ def build(
212
212
):
213
213
return
214
214
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 )
222
227
223
228
224
229
class _COFF (
You can’t perform that action at this time.
0 commit comments