diff options
author | shadchin <shadchin@yandex-team.com> | 2024-02-07 09:25:06 +0300 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-02-09 19:18:32 +0300 |
commit | f0785dc88eee3da0f1514f5b4cafa931571e669d (patch) | |
tree | 44165310ad6023cd29776f9b1b4477364cd2b5bb /contrib/tools/python3/src/Lib/_pyio.py | |
parent | 2c0985fb513cb5b352324abf223bf749c6c2bd24 (diff) | |
download | ydb-f0785dc88eee3da0f1514f5b4cafa931571e669d.tar.gz |
Update Python 3 to 3.11.8
Diffstat (limited to 'contrib/tools/python3/src/Lib/_pyio.py')
-rw-r--r-- | contrib/tools/python3/src/Lib/_pyio.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/tools/python3/src/Lib/_pyio.py b/contrib/tools/python3/src/Lib/_pyio.py index 0bfdeaafae..16d025b170 100644 --- a/contrib/tools/python3/src/Lib/_pyio.py +++ b/contrib/tools/python3/src/Lib/_pyio.py @@ -2224,8 +2224,9 @@ class TextIOWrapper(TextIOBase): self.buffer.write(b) if self._line_buffering and (haslf or "\r" in s): self.flush() - self._set_decoded_chars('') - self._snapshot = None + if self._snapshot is not None: + self._set_decoded_chars('') + self._snapshot = None if self._decoder: self._decoder.reset() return length @@ -2539,8 +2540,9 @@ class TextIOWrapper(TextIOBase): # Read everything. result = (self._get_decoded_chars() + decoder.decode(self.buffer.read(), final=True)) - self._set_decoded_chars('') - self._snapshot = None + if self._snapshot is not None: + self._set_decoded_chars('') + self._snapshot = None return result else: # Keep reading chunks until we have size characters to return. |