Skip to content

Commit 2fbf5d8

Browse files
authored
fix fallback code path in take!(::IOBuffer) method (JuliaLang#58762)
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.
1 parent 76df602 commit 2fbf5d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

base/iobuffer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ function take!(io::IOBuffer)
771771
elseif io.writable
772772
data = wrap(Array, memoryref(io.data, io.ptr), nbytes)
773773
else
774-
data = read!(io, data)
774+
error("Unreachable IOBuffer state")
775775
end
776776
end
777777
if io.writable

0 commit comments

Comments
 (0)