Skip to content

Don't reevaluate at__MODULE__#133

Merged
pfitzseb merged 5 commits intoJuliaDebug:masterfrom
serenity4:fix-global-assignment
Feb 18, 2025
Merged

Don't reevaluate at__MODULE__#133
pfitzseb merged 5 commits intoJuliaDebug:masterfrom
serenity4:fix-global-assignment

Conversation

@serenity4
Copy link
Copy Markdown
Contributor

I realized that #131 does not actually fix the issue on nightly (and was tricked into believing it did by a faulty setup 🤦). The issue is caused by this behavior:

julia> let; global mod = Module()
           println(isdefined(mod, Symbol("@xx")))
           Core.eval(mod, :(macro xx() end))
           println(isdefined(mod, Symbol("@xx")))
       end
false
true

julia> isdefined(mod, Symbol("@xx"))
true

julia> let; global mod = Module()
           println(isdefined(mod, Symbol("@__MODULE__")))
           Core.eval(mod, :(macro __MODULE__() end))
           println(isdefined(mod, Symbol("@__MODULE__")))
       end
false # <- this used to return `true` on 1.11
false

julia> isdefined(mod, Symbol("@__MODULE__"))
true

which I believe was introduced by JuliaLang/julia#57253. Invoking isdefined with invokelatest gives the correct answer.

This is a simple temporary fix, but perhaps this should be fixed upstream. cc @Keno

@pfitzseb pfitzseb merged commit 0dbab5b into JuliaDebug:master Feb 18, 2025
7 checks passed
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.

2 participants