aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Lib/_pyio.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-02-07 09:25:06 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-02-09 19:18:32 +0300
commitf0785dc88eee3da0f1514f5b4cafa931571e669d (patch)
tree44165310ad6023cd29776f9b1b4477364cd2b5bb /contrib/tools/python3/src/Lib/_pyio.py
parent2c0985fb513cb5b352324abf223bf749c6c2bd24 (diff)
downloadydb-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.py10
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.