Skip to content

Commit 07261b0

Browse files
committed
Don't use internal jl_set_const to create constants
The internal function `jl_set_const` is allowed during bootstrap only and ignores world age partition. This would give incorrect results after JuliaLang/julia#57150. Just eval the constant definition directly, which has well defined semantics.
1 parent ff34f4c commit 07261b0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/clusterserialize.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,12 @@ function deserialize_global_from_main(s::ClusterSerializer, sym)
167167
return nothing
168168
end
169169
end
170-
Core.eval(Main, Expr(:global, sym))
171170
if sym_isconst
172-
ccall(:jl_set_const, Cvoid, (Any, Any, Any), Main, sym, v)
171+
Core.eval(Main, Expr(:block,
172+
Expr(:const, GlobalRef(Main, sym), v),
173+
nothing))
173174
else
175+
Core.eval(Main, Expr(:global, sym))
174176
invokelatest(setglobal!, Main, sym, v)
175177
end
176178
return nothing

0 commit comments

Comments
 (0)