From ddf15ed052f99acafcc21a4eb20aa1d53ccac718 Mon Sep 17 00:00:00 2001 From: MilesCranmer Date: Wed, 1 Jan 2025 23:33:14 +0000 Subject: [PATCH] fix: patch changed behavior of `setproperty!` for modules --- src/JlWrap/any.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/JlWrap/any.jl b/src/JlWrap/any.jl index 8ea73907..66aee427 100644 --- a/src/JlWrap/any.jl +++ b/src/JlWrap/any.jl @@ -26,6 +26,10 @@ function pyjlany_setattr(self, k_::Py, v_::Py) k = Symbol(pyjl_attr_py2jl(pyconvert(String, k_))) pydel!(k_) v = pyconvert(Any, v_) + if VERSION >= v"1.11.0-" && self isa Module && !isdefined(self, k) + # Fix for https://github.com/JuliaLang/julia/pull/54678 + Base.Core.eval(self, Expr(:global, k)) + end setproperty!(self, k, v) Py(nothing) end