Skip to content

Commit

Permalink
remove REPL.__init__ (#48594)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Feb 8, 2023
1 parent ee82caa commit 578c432
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,12 @@ function docm(source::LineNumberNode, mod::Module, ex)
@nospecialize ex
if isexpr(ex, :->) && length(ex.args) > 1
return docm(source, mod, ex.args...)
else
elseif isassigned(Base.REPL_MODULE_REF)
# TODO: this is a shim to continue to allow `@doc` for looking up docstrings
REPL = Base.REPL_MODULE_REF[]
return REPL.lookup_doc(ex)
end
return nothing
end
# Drop incorrect line numbers produced by nested macro calls.
docm(source::LineNumberNode, mod::Module, _, _, x...) = docm(source, mod, x...)
Expand Down
5 changes: 5 additions & 0 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,8 @@ end

require(uuidkey::PkgId) = @lock require_lock _require_prelocked(uuidkey)

const REPL_PKGID = PkgId(UUID("3fa0cd96-eef1-5676-8a61-b3b8758bbffb"), "REPL")

function _require_prelocked(uuidkey::PkgId, env=nothing)
assert_havelock(require_lock)
if !root_module_exists(uuidkey)
Expand All @@ -1648,6 +1650,9 @@ function _require_prelocked(uuidkey::PkgId, env=nothing)
insert_extension_triggers(uuidkey)
# After successfully loading, notify downstream consumers
run_package_callbacks(uuidkey)
if uuidkey == REPL_PKGID
REPL_MODULE_REF[] = newm
end
else
newm = root_module(uuidkey)
end
Expand Down
4 changes: 0 additions & 4 deletions stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ include("docview.jl")

@nospecialize # use only declared type signatures

function __init__()
Base.REPL_MODULE_REF[] = REPL
end

answer_color(::AbstractREPL) = ""

const JULIA_PROMPT = "julia> "
Expand Down

0 comments on commit 578c432

Please sign in to comment.