diff --git a/stdlib/REPL/src/REPL.jl b/stdlib/REPL/src/REPL.jl index 19f46c472ba729..d179763ef114b5 100644 --- a/stdlib/REPL/src/REPL.jl +++ b/stdlib/REPL/src/REPL.jl @@ -1421,6 +1421,7 @@ function out_transform(@nospecialize(x), n::Ref{Int}) end function get_usings!(usings, ex) + ex isa Expr || return usings # get all `using` and `import` statements which are at the top level for (i, arg) in enumerate(ex.args) if Base.isexpr(arg, :toplevel) diff --git a/stdlib/REPL/test/repl.jl b/stdlib/REPL/test/repl.jl index 6049f2214bc4f2..2267f6550cbec1 100644 --- a/stdlib/REPL/test/repl.jl +++ b/stdlib/REPL/test/repl.jl @@ -1650,6 +1650,10 @@ fake_repl() do stdin_write, stdout_read, repl @test !contains(s, "ERROR") @test contains(s, "Test Passed") + # Test for https://github.com/JuliaLang/julia/issues/49319 + s = sendrepl2("# comment", "In [16]") + @test !contains(s, "ERROR") + write(stdin_write, '\x04') Base.wait(repltask) end