Skip to content

Commit b9b8b38

Browse files
authored
Move test of stackoverflow with close(::Channel) to stack_overflow.jl (#49702)
Per @vtjnash's comment here: https://github.com/JuliaLang/julia/pull/49508/files/bca5ac79d04fb2a95f3b9a7b7448fe5b478f950b#r1186161259 > the handling of this error is quite bad and sometimes ends up breaking > the process (as I found out today trying to debug something completely > unrelated) This is a Tests-only PR
1 parent d10d90c commit b9b8b38

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

test/channels.jl

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -626,20 +626,3 @@ end
626626
@test n_avail(c) == 0
627627
end
628628
end
629-
630-
# Issue #49507: stackoverflow in type inference caused by close(::Channel, ::Exception)
631-
@testset "close(::Channel, ::StackOverflowError)" begin
632-
ch = let result = Channel()
633-
foo() = try
634-
foo()
635-
catch e;
636-
close(result, e)
637-
end
638-
639-
foo() # This shouldn't fail with an internal stackoverflow error in inference.
640-
641-
result
642-
end
643-
644-
@test (try take!(ch) catch e; e; end) isa StackOverflowError
645-
end

test/stack_overflow.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,20 @@ let exename = Base.julia_cmd()
1717
@show readchomperrors(`$exename -e "f() = f(); f()"`)
1818
@show readchomperrors(`$exename -e "f() = f(); fetch(@async f())"`)
1919
end
20+
21+
# Issue #49507: stackoverflow in type inference caused by close(::Channel, ::Exception)
22+
@testset "close(::Channel, ::StackOverflowError)" begin
23+
ch = let result = Channel()
24+
foo() = try
25+
foo()
26+
catch e;
27+
close(result, e)
28+
end
29+
30+
foo() # This shouldn't fail with an internal stackoverflow error in inference.
31+
32+
result
33+
end
34+
35+
@test (try take!(ch) catch e; e; end) isa StackOverflowError
36+
end

0 commit comments

Comments
 (0)