mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 12:36:54 +00:00
ensure crlf line endings of stdin are handled properly
This commit is contained in:
parent
ff433b2e64
commit
0bf8d2a885
2 changed files with 12 additions and 1 deletions
|
|
@ -195,7 +195,8 @@ def _stdin_get_value_py3(): # type: () -> str
|
|||
fd = io.BytesIO(stdin_value)
|
||||
try:
|
||||
coding, _ = tokenize.detect_encoding(fd.readline)
|
||||
return stdin_value.decode(coding)
|
||||
fd.seek(0)
|
||||
return io.TextIOWrapper(fd, coding).read()
|
||||
except (LookupError, SyntaxError, UnicodeError):
|
||||
return stdin_value.decode("utf-8")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue