[pypy-commit] pypy py3.6: Fix bpo-25862
rlamy
pypy.commits at gmail.com
Thu Aug 8 11:00:33 EDT 2019
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.6
Changeset: r97104:8b8aaf492f23
Date: 2019-08-08 15:59 +0100
http://bitbucket.org/pypy/pypy/changeset/8b8aaf492f23/
Log: Fix bpo-25862
diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -746,6 +746,7 @@
check_decoded(space, w_decoded)
w_result = space.newtext(self.decoded.get_chars(-1))
w_final = space.add(w_result, w_decoded)
+ self.decoded.reset()
self.snapshot = None
return w_final
@@ -892,6 +893,7 @@
if needflush:
space.call_method(self.w_buffer, "flush")
+ self.decoded.reset()
self.snapshot = None
if self.w_decoder:
diff --git a/pypy/module/_io/test/test_textio.py b/pypy/module/_io/test/test_textio.py
--- a/pypy/module/_io/test/test_textio.py
+++ b/pypy/module/_io/test/test_textio.py
@@ -458,6 +458,18 @@
t.__init__(_io.BytesIO())
assert t.read(0) == u''
+ def test_issue25862(self):
+ # CPython issue #25862
+ # Assertion failures occurred in tell() after read() and write().
+ from _io import TextIOWrapper, BytesIO
+ t = TextIOWrapper(BytesIO(b'test'), encoding='ascii')
+ t.read(1)
+ t.read()
+ t.tell()
+ t = TextIOWrapper(BytesIO(b'test'), encoding='ascii')
+ t.read(1)
+ t.write('x')
+ t.tell()
class AppTestIncrementalNewlineDecoder:
def test_newline_decoder(self):
More information about the pypy-commit
mailing list