From ae29cc24cb131eeffb712b31b07b9a54f6fa680c Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Wed, 5 Jun 2024 00:23:22 +0000 Subject: [PATCH] Don't rely on implicit binding creation by setglobal As discussed in [1], the implicit creation of bindings through the setglobal! intrinsic was accidentally added in 1.9 unintentionally and will be removed (ideally) or at the very least deprecated in 1.11. The recommended replacement syntax is `Core.eval(mod, Expr(:global, sym))` to introduce the binding and `invokelatest(setglobal!, mod, sym, val)` to set it. The invokelatest is not presently required, but may be required for https://github.com/JuliaLang/julia/pull/54654, so it's included in the recommendation. [1] https://github.com/JuliaLang/julia/issues/54607 --- src/clusterserialize.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/clusterserialize.jl b/src/clusterserialize.jl index 0acd4ce..d2f09e7 100644 --- a/src/clusterserialize.jl +++ b/src/clusterserialize.jl @@ -167,10 +167,11 @@ 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) else - setglobal!(Main, sym, v) + invokelatest(setglobal!, Main, sym, v) end return nothing end