diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-06-29 10:34:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-29 10:34:34 (GMT) |
commit | eabebbb54c2604fd8d08e8019ea1be634aed8c2f (patch) | |
tree | 753a4129f0ff70097c60b461f916f230352d747b /Modules/_io/textio.c | |
parent | d0b442803ad4ba66b0bdb3cf183179d4c9a56f06 (diff) | |
download | cpython-eabebbb54c2604fd8d08e8019ea1be634aed8c2f.zip cpython-eabebbb54c2604fd8d08e8019ea1be634aed8c2f.tar.gz cpython-eabebbb54c2604fd8d08e8019ea1be634aed8c2f.tar.bz2 |
bpo-25862: Fix assertion failures in io.TextIOWrapper.tell(). (GH-3918)
(cherry picked from commit 23db935bcf258657682e66464bf8512def8af830)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Modules/_io/textio.c')
-rw-r--r-- | Modules/_io/textio.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index 717b56a..fa162e2 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -694,6 +694,9 @@ typedef struct PyObject *dict; } textio; +static void +textiowrapper_set_decoded_chars(textio *self, PyObject *chars); + /* A couple of specialized cases in order to bypass the slow incremental encoding methods for the most popular encodings. */ @@ -1606,6 +1609,7 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text) Py_DECREF(ret); } + textiowrapper_set_decoded_chars(self, NULL); Py_CLEAR(self->snapshot); if (self->decoder) { @@ -1835,6 +1839,7 @@ _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n) if (result == NULL) goto fail; + textiowrapper_set_decoded_chars(self, NULL); Py_CLEAR(self->snapshot); return result; } |