-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lost data from mark/reset? #78
Labels
Comments
Here is some more detailed debugging data for a byte-by-byte read (not using julia> io = BufferedInputStream(IOBuffer("α∆"), 1)
BufferedInputStream{IOBuffer}(<1 B buffer, 0% filled>)
julia> read(io, Char)
'α': Unicode U+03B1 (category Ll: Letter, lowercase)
julia> mark(io)
2
julia> @show io.buffer, io.position, io.available, io.anchor
(io.buffer, io.position, io.available, io.anchor) = (UInt8[0xb1], 2, 1, 2)
(UInt8[0xb1], 2, 1, 2)
julia> read(io, UInt8)
0xe2
julia> @show io.buffer, io.position, io.available, io.anchor
(io.buffer, io.position, io.available, io.anchor) = (UInt8[0xe2], 2, 1, 2)
(UInt8[0xe2], 2, 1, 2)
julia> read(io, UInt8)
0x88
julia> @show io.buffer, io.position, io.available, io.anchor
(io.buffer, io.position, io.available, io.anchor) = (UInt8[0x88], 2, 1, 2)
(UInt8[0x88], 2, 1, 2)
julia> read(io, UInt8)
0x86
julia> @show io.buffer, io.position, io.available, io.anchor
(io.buffer, io.position, io.available, io.anchor) = (UInt8[0x86], 2, 1, 2)
(UInt8[0x86], 2, 1, 2)
julia> reset(io)
2
julia> @show io.buffer, io.position, io.available, io.anchor
(io.buffer, io.position, io.available, io.anchor) = (UInt8[0x86], 2, 1, 0)
(UInt8[0x86], 2, 1, 0) My understanding was that |
stevengj
changed the title
bug in peek(io::BufferedInputStream, Char)
lost data from mark/reset?
Jul 12, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I noticed this when rewriting
peek
in #77. Runningpeek
(which callsmark
andreset
) sometimes seems to screw up the buffer so that the subsequentread
fails:PR #77 avoids this problem specifically for
peek(io, Char)
since it adds an optimized implementation of that function, but it would be good to identify and solve the underlying problem.The text was updated successfully, but these errors were encountered: