Skip to content

Commit

Permalink
loading: prevent module replacement during precompile
Browse files Browse the repository at this point in the history
This is theoretically okay, but unlikely to be intended ever.
  • Loading branch information
vtjnash committed Jun 30, 2022
1 parent fec6951 commit d81724a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,11 @@ root_module_key(m::Module) = @lock require_lock module_keys[m]
if haskey(loaded_modules, key)
oldm = loaded_modules[key]
if oldm !== m
@warn "Replacing module `$(key.name)`"
if (0 != ccall(:jl_generating_output, Cint, ())) && (JLOptions().incremental != 0)
error("Replacing module `$(key.name)`")
else
@warn "Replacing module `$(key.name)`"
end
end
end
loaded_modules[key] = m
Expand Down

0 comments on commit d81724a

Please sign in to comment.