From 5e52d82cfdd3641ed1b812a5afb20b313db47a54 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Wed, 2 Oct 2024 23:47:36 +0000 Subject: [PATCH] Stop using `eval` to find module location I added an explicit accessor for this in https://github.com/JuliaLang/julia/pull/55963 so Revise doesn't have to rely on internals. --- src/loading.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/loading.jl b/src/loading.jl index 58e2efee..0aa5af57 100644 --- a/src/loading.jl +++ b/src/loading.jl @@ -75,7 +75,11 @@ function modulefiles(mod::Module) filename = fixpath(filename) return get(src_file_key, filename, filename) end - parentfile = String(first(methods(getfield(mod, :eval))).file) + if isdefined(Base, :moduleloc) + parentfile = String(Base.moduleloc(mod).file) + else + parentfile = String(first(methods(getfield(mod, :eval))).file) + end id = PkgId(mod) if id.name == "Base" || Symbol(id.name) ∈ stdlib_names parentfile = normpath(Base.find_source_file(parentfile))