From 5535a1383611425a245002126eaf39734e590f1c Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Wed, 18 Jun 2025 01:03:15 +0900 Subject: [PATCH] fix fallback code path in `take!(::IOBuffer)` method JET told me that the `data` local variable was inparticular is undefined at this point. After reviewing this code, I think this code path is unreachable actually since `bytesavailable(io::IOBuffer)` returns `0` when `io` has been closed. So it's probably better to make it clear. --- base/iobuffer.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/iobuffer.jl b/base/iobuffer.jl index b2e51618a8835..dd3b757c0e3f0 100644 --- a/base/iobuffer.jl +++ b/base/iobuffer.jl @@ -771,7 +771,7 @@ function take!(io::IOBuffer) elseif io.writable data = wrap(Array, memoryref(io.data, io.ptr), nbytes) else - data = read!(io, data) + error("Unreachable IOBuffer state") end end if io.writable