Skip to content

Commit

Permalink
Fix for packages not loaded into Main on 0.7 (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan authored Sep 22, 2017
1 parent f414d7b commit d89aa72
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/JLD.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1246,8 +1246,17 @@ function FileIO.load(f::File{format"JLD"}, varnames::Tuple{Vararg{AbstractString
end
end

# As of this version, packages aren't loaded into Main by default, so the root
# module check verifies that packages are still identified as being top level
# even if a binding to them is not present in Main.
if VERSION >= v"0.7.0-DEV.1877"
_istoplevel(m::Module) = module_parent(m) == Main || Base.is_root_module(m)
else
_istoplevel(m::Module) = module_parent(m) == Main
end

function addrequire(file::JldFile, mod::Module)
module_parent(mod) == Main || error("must be a toplevel module")
_istoplevel(mod) || error("must be a toplevel module")
addrequire(file, module_name(mod))
end

Expand Down

0 comments on commit d89aa72

Please sign in to comment.