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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MilesCranmer
Copy link
Contributor

@MilesCranmer MilesCranmer commented Jan 1, 2025

This fixes the breaking change introduced by Julia 1.11: JuliaLang/julia#54678. Fixes #582. See JuliaLang/julia#56933 for more discussion.

The fix is pretty simple - we just automatically call global on variables that are undefined. This means that the syntax

from juliacall import Main as jl

jl.x = 1

will continue to function.

@cjdoris could you please take a look and merge? Since Julia 1.11 is out now I think we should get this fix in relatively quickly since a lot of the docs and tutorials rely on this behavior working.


Edit: also fixed some of the other tests (see discussion below)

@@ -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}}

@MilesCranmer
Copy link
Contributor Author

FYI I'm ignoring some of the broken tests (only two; seem minor) temporarily since I see the setproperty! issue as being much more impactful

@MilesCranmer
Copy link
Contributor Author

MilesCranmer commented Jan 2, 2025

The only remaining test error is from the julia_gc test. I think it's more likely this is due to Julia bugs since 1.11's parallel GC has some internal issues (e.g., JuliaLang/julia#56871, JuliaLang/julia#56759, JuliaLang/julia#56735).

I'll turn off that test for 1.11 too, since it doesn't identify an issue with PythonCall.jl (if that's alright with you). We can look into it later once 1.11.3 comes out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Julia 1.11 prevents assigning objects to Main
1 participant