Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1075,10 +1075,16 @@ function register_restored_modules(sv::SimpleVector, pkg::PkgId, path::String)
return restored
end

function run_package_callbacks(modkey::PkgId)


function run_package_callbacks_and_extension_triggers(modkey::PkgId)
run_extension_callbacks()
run_package_callbacks(modkey)
end

function run_package_callbacks(modkey)
Comment on lines +1082 to +1085
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The separate function does not seem to be necessary?

Suggested change
run_package_callbacks(modkey)
end
function run_package_callbacks(modkey)

assert_havelock(require_lock)
unlock(require_lock)
run_extension_callbacks()
try
for callback in package_callbacks
invokelatest(callback, modkey)
Expand Down Expand Up @@ -1202,7 +1208,7 @@ function run_extension_callbacks(; force::Bool=false)
@debug "Extension $(extid.id.name) of $(extid.parentid.name) not loaded due to \
$(ext_not_allowed_load.name) loaded in environment lower in load path"
else
require(extid.id)
_require_prelocked(extid.id)
@debug "Extension $(extid.id.name) of $(extid.parentid.name) loaded"
end
extid.succeeded = true
Expand Down Expand Up @@ -1264,7 +1270,7 @@ function _tryrequire_from_serialized(modkey::PkgId, build_id::UInt128)
end
if loaded isa Module
insert_extension_triggers(modkey)
run_package_callbacks(modkey)
run_package_callbacks_and_extension_triggers(modkey)
end
end
end
Expand Down Expand Up @@ -1305,7 +1311,7 @@ function _tryrequire_from_serialized(modkey::PkgId, path::String, ocachepath::Un
end
if loaded isa Module
insert_extension_triggers(modkey)
run_package_callbacks(modkey)
run_package_callbacks_and_extension_triggers(modkey)
end
end
end
Expand Down Expand Up @@ -1574,7 +1580,7 @@ function _require_prelocked(uuidkey::PkgId, env=nothing)
end
insert_extension_triggers(uuidkey)
# After successfully loading, notify downstream consumers
run_package_callbacks(uuidkey)
run_package_callbacks_and_extension_triggers(uuidkey)
else
newm = root_module(uuidkey)
end
Expand Down Expand Up @@ -1767,7 +1773,7 @@ function _require_from_serialized(uuidkey::PkgId, path::String, ocachepath::Unio
newm isa Module || throw(newm)
insert_extension_triggers(uuidkey)
# After successfully loading, notify downstream consumers
run_package_callbacks(uuidkey)
run_package_callbacks_and_extension_triggers(uuidkey)
return newm
end
end
Expand Down