diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-01-08 11:00:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-08 11:00:30 (GMT) |
commit | ad2d5ec97e12063b7265faa8b0654bcf82a33545 (patch) | |
tree | cc47b503dba1ed45b335d62a21d74798bab13bfb /Lib/test | |
parent | db6f297d448ce46e58a5b90239a4779553333198 (diff) | |
download | cpython-ad2d5ec97e12063b7265faa8b0654bcf82a33545.zip cpython-ad2d5ec97e12063b7265faa8b0654bcf82a33545.tar.gz cpython-ad2d5ec97e12063b7265faa8b0654bcf82a33545.tar.bz2 |
[3.12] gh-80109: Fix io.TextIOWrapper dropping the internal buffer during write() (GH-22535) (GH-113808)
io.TextIOWrapper was dropping the internal decoding buffer
during read() and write() calls.
(cherry picked from commit 73c93265634257b1488262097e024c1727260cfd)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_io.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 196b7d2..cceaed8 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -3891,6 +3891,14 @@ class TextIOWrapperTest(unittest.TestCase): t.write('x') t.tell() + def test_issue35928(self): + p = self.BufferedRWPair(self.BytesIO(b'foo\nbar\n'), self.BytesIO()) + f = self.TextIOWrapper(p) + res = f.readline() + self.assertEqual(res, 'foo\n') + f.write(res) + self.assertEqual(res + f.readline(), 'foo\nbar\n') + class MemviewBytesIO(io.BytesIO): '''A BytesIO object whose read method returns memoryviews |