-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorioInvolving the I/O subsystem: libuv, read, write, etc.Involving the I/O subsystem: libuv, read, write, etc.
Milestone
Description
I noticed this with IOBuffer, but it looks like IOStream, AsyncStream, and File all have the same issue. In each of their read!{T,N}(::IO, a::Array{T,N})
methods, they assume that the number of bytes to read is length(a)*sizeof(T)
. This is not true for Char
:
julia> buf = IOBuffer("abcdefghijklmnop");
julia> read(buf, Char)
'a'
julia> read(buf, Char, 2) # dispatches to read!(IOBuffer, Array{Char,1})
2-element Array{Char,1}:
'\U65646362'
'\U69686766'
For IOBuffer, I think the specialization could simply be removed (albeit perhaps at a small performance loss). The others, however, are trickier — File performance is much more critical and the Async/IOStream ones need to know how many bytes to wait for.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorioInvolving the I/O subsystem: libuv, read, write, etc.Involving the I/O subsystem: libuv, read, write, etc.