Skip to content

Commit 68282be

Browse files
committed
Simplify logic for channel exception
This was a simplification missed in original JuliaLang#35177
1 parent 1c16afd commit 68282be

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

base/channels.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,9 @@ function close_chnl_on_taskdone(t::Task, c::Channel)
279279
lock(c)
280280
try
281281
isopen(c) || return
282-
if istaskfailed(t)
283-
excp = task_result(t)
284-
if excp isa Exception
285-
close(c, TaskFailedException(t))
286-
return
287-
end
282+
if istaskfailed(t) && task_result(t) isa Exception
283+
close(c, TaskFailedException(t))
284+
return
288285
end
289286
close(c)
290287
finally

0 commit comments

Comments
 (0)