Skip to content

Commit b078d77

Browse files
authored
Fix UndefVarError due to unintentional signature change (#43173)
* Fix UndefVarError due to unintentional signature change * Add wait for REPL task to exit * Add test * test fix * no invoke
1 parent d87c384 commit b078d77

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

base/client.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ end
106106
display_error(stack::ExceptionStack) = display_error(stderr, stack)
107107

108108
# these forms are depended on by packages outside Julia
109-
function display_error(io::IO, exception, backtrace)
109+
function display_error(io::IO, er, bt)
110110
printstyled(io, "ERROR: "; bold=true, color=Base.error_color())
111111
showerror(IOContext(io, :limit => true), er, bt, backtrace = bt!==nothing)
112112
println(io)

stdlib/REPL/test/repl.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,4 +1402,6 @@ fake_repl() do stdin_write, stdout_read, repl
14021402
@test readline(stdout_read) == "\e[0m1-element ExceptionStack:"
14031403
@test readline(stdout_read) == "UndefVarError: foobar not defined"
14041404
@test readline(stdout_read) == "Stacktrace:"
1405+
write(stdin_write, '\x04')
1406+
Base.wait(repltask)
14051407
end

test/client.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,12 @@ end
4343
err_str = String(take!(errio))
4444
@test occursin(nested_error_pattern, err_str)
4545
end
46+
47+
@testset "display_error(io, er, bt) works" begin
48+
errio = IOBuffer()
49+
Base.display_error(errio, ErrorException, [])
50+
err_str = String(take!(errio))
51+
@test occursin(r"""
52+
ERROR: ErrorException
53+
"""s, err_str)
54+
end

0 commit comments

Comments
 (0)