Skip to content

Commit 44734d5

Browse files
wangl-ccKristofferC
authored andcommitted
Check input expresion in numbered prompt (#50064)
(cherry picked from commit 7e3c706)
1 parent 952f8cb commit 44734d5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

stdlib/REPL/src/REPL.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,7 @@ function out_transform(@nospecialize(x), n::Ref{Int})
14211421
end
14221422

14231423
function get_usings!(usings, ex)
1424+
ex isa Expr || return usings
14241425
# get all `using` and `import` statements which are at the top level
14251426
for (i, arg) in enumerate(ex.args)
14261427
if Base.isexpr(arg, :toplevel)

stdlib/REPL/test/repl.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,10 @@ fake_repl() do stdin_write, stdout_read, repl
16501650
@test !contains(s, "ERROR")
16511651
@test contains(s, "Test Passed")
16521652

1653+
# Test for https://github.com/JuliaLang/julia/issues/49319
1654+
s = sendrepl2("# comment", "In [16]")
1655+
@test !contains(s, "ERROR")
1656+
16531657
write(stdin_write, '\x04')
16541658
Base.wait(repltask)
16551659
end

0 commit comments

Comments
 (0)