diff options
| author | Anthony Sottile <asottile@umich.edu> | 2021-01-07 08:41:11 -0800 |
|---|---|---|
| committer | Anthony Sottile <asottile@umich.edu> | 2021-01-07 09:15:46 -0800 |
| commit | 0bf8d2a88586b6a1490fd5eaa1d29e1ed16ea705 (patch) | |
| tree | 17bfb71e42f3902cda825dcd64eb4c9903465951 /src | |
| parent | ff433b2e64e864e44ce0fbb9a0145fe7164db904 (diff) | |
| download | flake8-0bf8d2a88586b6a1490fd5eaa1d29e1ed16ea705.tar.gz | |
ensure crlf line endings of stdin are handled properly
Diffstat (limited to 'src')
| -rw-r--r-- | src/flake8/utils.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/flake8/utils.py b/src/flake8/utils.py index 8963011..29dc554 100644 --- a/src/flake8/utils.py +++ b/src/flake8/utils.py @@ -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") |
