Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: patch changed behavior of setproperty! for modules #583

Merged
merged 15 commits into from
Jan 20, 2025
4 changes: 4 additions & 0 deletions src/JlWrap/any.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion test/Aqua.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
# The unbound_args test fails on methods with signature like foo(::Type{Tuple{Vararg{V}}}) where V
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated but this is a real unbound_args. V is unbound in Tuple{Vararg{V}} because () is technically a subtype - in which case V has no definition.

Correct signature with bounded V would be Tuple{V,Vararg{V}}

# Seems like a bug.
import Aqua
Aqua.test_all(PythonCall, unbound_args = false)
Aqua.test_all(
PythonCall,
unbound_args = false,
stale_deps = (; ignore = [:REPL])
)
end
Loading