Skip to content

Commit 12f6747

Browse files
authored
Merge pull request #21317 from JuliaLang/jb/fix21314
fix #21314, `close` on a SubArray-based IOBuffer
2 parents 88db576 + f3a1570 commit 12f6747

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

base/iobuffer.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Stateful string
66
mutable struct AbstractIOBuffer{T<:AbstractVector{UInt8}} <: IO
7-
data::T # T should support: getindex, setindex!, length, copy!, resize!, and T()
7+
data::T # T should support: getindex, setindex!, length, copy!, and resize!
88
readable::Bool
99
writable::Bool
1010
seekable::Bool # if not seekable, implementation is free to destroy (compact) past read data
@@ -251,8 +251,6 @@ eof(io::AbstractIOBuffer) = (io.ptr-1 == io.size)
251251
io.mark = -1
252252
if io.writable
253253
resize!(io.data, 0)
254-
else
255-
io.data = T()
256254
end
257255
nothing
258256
end

test/base64.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ ipipe = Base64DecodePipe(IOBuffer(string(encodedMaxLine76[1:end-2],"==")))
4141
# Test incorrect format
4242
ipipe = Base64DecodePipe(IOBuffer(encodedMaxLine76[1:end-3]))
4343
@test_throws ArgumentError readstring(ipipe)
44+
45+
# issue #21314
46+
@test base64decode(chomp("test")) == base64decode("test")

0 commit comments

Comments
 (0)