-
Notifications
You must be signed in to change notification settings - Fork 154
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
pull request #778 breaks streaming inputs #779
Comments
Did 1.10.1 fix it? Can you provide a way to reproduce? |
Aha you edited - I’ll add a test. |
if you are mucking about in there, i'm pretty sure that you will need a seek or other way of resetting the file in this block. Lines 64 to 67 in 2898d17
|
not an agate test but, here's a csvkit repro. echo "a" | csvsort |
Yeah, It can read from stdin
We're passing
|
got it. got confused with the overwriting of |
I started #780 The docstring says sniff_limit reads bytes, which is true for stdin (now), but it actually reads characters for the original behavior. Would need something like:
I can also check if anyone wrote a peekable TextIOWrapper I should also see what happens if Edit: Add test for sniff limit that ends within UTF8 character. Edit2: sys.stdin.buffer.peek() always reads the entire input, up to 65536 bytes (on my machine at least, and in CPython at least). So, a test would be difficult, but I checked the logic with: import io
io.BufferedReader(io.BytesIO('ʤ,ʤ,c\n1,2,3'.encode()), 4).peek().decode('utf-8')
# UnicodeDecodeError
io.BufferedReader(io.BytesIO('ʤ,ʤ,c\n1,2,3'.encode()), 4).peek().decode('utf-8', 'ignore')
# 'ʤ,' |
Thank you for reporting! Should be fixed in 1.10.2. |
PR #778 introduced a
seek
that is not compatible with stdin and other inputs that do not provide seek.The text was updated successfully, but these errors were encountered: