Skip to content

Commit

Permalink
Merge pull request #125 from JuliaLang/kf/jlsetconst
Browse files Browse the repository at this point in the history
Don't use internal jl_set_const to create constants
  • Loading branch information
JamesWrigley authored Jan 26, 2025
2 parents 1c7eb92 + 52d5703 commit 0887df4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/clusterserialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,15 @@ function deserialize_global_from_main(s::ClusterSerializer, sym)
return nothing
end
end
Core.eval(Main, Expr(:global, sym))
if sym_isconst
ccall(:jl_set_const, Cvoid, (Any, Any, Any), Main, sym, v)
# Note that the post-lowering const form is not allowed in value
# position, so there needs to be a dummy `nothing` argument to drop the
# return value.
Core.eval(Main, Expr(:block,
Expr(:const, GlobalRef(Main, sym), v),
nothing))
else
Core.eval(Main, Expr(:global, sym))
invokelatest(setglobal!, Main, sym, v)
end
return nothing
Expand Down

0 comments on commit 0887df4

Please sign in to comment.