Skip to content

Commit ac3d1de

Browse files
committed
DocMeta: Access META binding through invokelatest
Starting in Julia 1.12, global bindings have strict world-age semantics so this change is required to avoid the warning introduced by JuliaLang/julia#57133
1 parent 6abd828 commit ac3d1de

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/DocMeta.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ const VALIDMETA = Dict{Symbol, Type}(:DocTestSetup => Union{Expr, Symbol})
3131
"""
3232
"""
3333
function initdocmeta!(m::Module)
34-
if !isdefined(m, META)
34+
if !invokelatest(isdefined, m, META)
3535
@debug "Creating documentation metadata dictionary (META=$META) in $m"
3636
Core.eval(m, :(const $META = $(METATYPE())))
3737
push!(METAMODULES, m)
3838
else
3939
@warn "Existing documentation metadata dictionary (META=$META) in $m. Ignoring."
4040
end
41-
return getfield(m, META)
41+
return invokelatest(getfield, m, META)
4242
end
4343

4444
"""
@@ -48,7 +48,7 @@ Returns the documentation metadata dictionary for the module `m`. The dictionary
4848
considered immutable and assigning values to it is not well-defined. To set documentation
4949
metadata values, [`DocMeta.setdocmeta!`](@ref) should be used instead.
5050
"""
51-
getdocmeta(m::Module) = isdefined(m, META) ? getfield(m, META) : METATYPE()
51+
getdocmeta(m::Module) = invokelatest(isdefined, m, META) ? invokelatest(getfield, m, META) : METATYPE()
5252

5353
"""
5454
getdocmeta(m::Module, key::Symbol, default=nothing)
@@ -74,7 +74,7 @@ function setdocmeta!(m::Module, key::Symbol, value; warn = true, recursive = fal
7474
setdocmeta!(mod, key, value; warn = warn, recursive = false)
7575
end
7676
else
77-
isdefined(m, META) || initdocmeta!(m)
77+
invokelatest(isdefined, m, META) || initdocmeta!(m)
7878
meta = getdocmeta(m)
7979
if warn && haskey(meta, key)
8080
@warn "$(key) already set for module $m. Overwriting."

0 commit comments

Comments
 (0)