From 36ace5430d5b54ec3f7045b980002fe2f600e508 Mon Sep 17 00:00:00 2001 From: Nathan Daly Date: Tue, 25 Apr 2023 21:14:02 -0600 Subject: [PATCH] Nospecialize close(c::Channel, excp::Exception) on excp. Fixes https://github.com/JuliaLang/julia/issues/49507. Avoids dynamic dispatch when closing a Channel with an Exception, and should avoid a call into the runtime for julia compilation when attempting to report an exception. --- base/channels.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/channels.jl b/base/channels.jl index aa4d913dcdadd..07f1975bcee81 100644 --- a/base/channels.jl +++ b/base/channels.jl @@ -183,7 +183,7 @@ Close a channel. An exception (optionally given by `excp`), is thrown by: * [`put!`](@ref) on a closed channel. * [`take!`](@ref) and [`fetch`](@ref) on an empty, closed channel. """ -function close(c::Channel, excp::Exception=closed_exception()) +function close(c::Channel, @nospecialize(excp::Exception=closed_exception())) lock(c) try c.excp = excp