Skip to content

Pkg commands fail if the REPL package has been loaded prior to it #58373

@serenity4

Description

@serenity4

On master, if I load REPL with -e or in my startup file (directly or transitively through another package), attempting to use the Pkg from the REPL gets me an error:

./julia -qie 'using REPL'
(@v1.13) pkg> st

SYSTEM (REPL): showing an error caused an error
ERROR: MethodError: no method matching stacktrace(::MethodError)
The function `stacktrace` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  stacktrace(::Bool)
   @ Base stacktraces.jl:202
  stacktrace()
   @ Base stacktraces.jl:202
  stacktrace(::Vector{<:Union{Ptr{Nothing}, Base.InterpreterIP}}, ::Bool)
   @ Base stacktraces.jl:189
  ...

Stacktrace:
 [1] scrub_repl_backtrace(bt::MethodError)
   @ Base ./client.jl:101
 [2] print_response(errio::IO, response::Any, backend::Union{…}, show_value::Bool, have_color::Bool, specialdisplay::Union{…})
   @ REPL ~/julia/master3/usr/share/julia/stdlib/v1.13/REPL/src/REPL.jl:590
 [3] (::REPL.var"#print_response##0#print_response##1"{LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
   @ REPL ~/julia/master3/usr/share/julia/stdlib/v1.13/REPL/src/REPL.jl:566
 [4] with_repl_linfo(f::Any, repl::LineEditREPL)
   @ REPL ~/julia/master3/usr/share/julia/stdlib/v1.13/REPL/src/REPL.jl:841
 [5] print_response(repl::AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
   @ REPL ~/julia/master3/usr/share/julia/stdlib/v1.13/REPL/src/REPL.jl:564
 [6] (::REPL.var"#do_respond#74"{})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
   @ REPL ~/julia/master3/usr/share/julia/stdlib/v1.13/REPL/src/REPL.jl:1204
 [7] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
   @ REPL.LineEdit ~/julia/master3/usr/share/julia/stdlib/v1.13/REPL/src/LineEdit.jl:2854
 [8] run_frontend(repl::LineEditREPL, backend::REPL.REPLBackendRef)
   @ REPL ~/julia/master3/usr/share/julia/stdlib/v1.13/REPL/src/REPL.jl:1675
 [9] (::REPL.var"#61#62"{LineEditREPL, REPL.REPLBackendRef})()
   @ REPL ~/julia/master3/usr/share/julia/stdlib/v1.13/REPL/src/REPL.jl:658
Some type information was truncated. Use `show(err)` to see complete types.

while loading Pkg in either the startup file, with the -e command or manually within the REPL works fine.

This is caused by the require_stdlib behavior, but I do notice this as a regression where until recently we seemed to be dealing with this just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions