mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
GH-90344: replace single-call io.IncrementalNewlineDecoder usage with non-incremental newline decoders (GH-30276)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Brett Cannon <brett@python.org>
This commit is contained in:
parent
f0a8bc737a
commit
453d886f85
4 changed files with 5 additions and 10 deletions
|
|
@ -552,8 +552,7 @@ def decode_source(source_bytes):
|
|||
import tokenize # To avoid bootstrap issues.
|
||||
source_bytes_readline = _io.BytesIO(source_bytes).readline
|
||||
encoding = tokenize.detect_encoding(source_bytes_readline)
|
||||
newline_decoder = _io.IncrementalNewlineDecoder(None, True)
|
||||
return newline_decoder.decode(source_bytes.decode(encoding[0]))
|
||||
return _io.TextIOWrapper(_io.BytesIO(source_bytes), encoding=encoding[0], newline=None).read()
|
||||
|
||||
|
||||
# Module specifications #######################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue