From b9b8b38ec09b4e91b46fa833c609e0cf2b9eba45 Mon Sep 17 00:00:00 2001 From: Nathan Daly Date: Tue, 9 May 2023 14:47:27 -0600 Subject: [PATCH] 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 --- test/channels.jl | 17 ----------------- test/stack_overflow.jl | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/test/channels.jl b/test/channels.jl index 89b0e5c09d7d8..dbda5cf069081 100644 --- a/test/channels.jl +++ b/test/channels.jl @@ -626,20 +626,3 @@ end @test n_avail(c) == 0 end end - -# Issue #49507: stackoverflow in type inference caused by close(::Channel, ::Exception) -@testset "close(::Channel, ::StackOverflowError)" begin - ch = let result = Channel() - foo() = try - foo() - catch e; - close(result, e) - end - - foo() # This shouldn't fail with an internal stackoverflow error in inference. - - result - end - - @test (try take!(ch) catch e; e; end) isa StackOverflowError -end diff --git a/test/stack_overflow.jl b/test/stack_overflow.jl index 9f4bae6f3f5b3..297186c8a4d3a 100644 --- a/test/stack_overflow.jl +++ b/test/stack_overflow.jl @@ -17,3 +17,20 @@ let exename = Base.julia_cmd() @show readchomperrors(`$exename -e "f() = f(); f()"`) @show readchomperrors(`$exename -e "f() = f(); fetch(@async f())"`) end + +# Issue #49507: stackoverflow in type inference caused by close(::Channel, ::Exception) +@testset "close(::Channel, ::StackOverflowError)" begin + ch = let result = Channel() + foo() = try + foo() + catch e; + close(result, e) + end + + foo() # This shouldn't fail with an internal stackoverflow error in inference. + + result + end + + @test (try take!(ch) catch e; e; end) isa StackOverflowError +end