diff options
author | Zackery Spytz <zspytz@gmail.com> | 2018-06-29 10:14:58 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-06-29 10:14:58 (GMT) |
commit | 23db935bcf258657682e66464bf8512def8af830 (patch) | |
tree | 1ee4e96c8aba659a705a51e307de77a0f97e00fc /Modules/_io | |
parent | bda9c3eae3ad16e43145599ac6359bfdcaf1fd4a (diff) | |
download | cpython-23db935bcf258657682e66464bf8512def8af830.zip cpython-23db935bcf258657682e66464bf8512def8af830.tar.gz cpython-23db935bcf258657682e66464bf8512def8af830.tar.bz2 |
bpo-25862: Fix assertion failures in io.TextIOWrapper.tell(). (GH-3918)
Diffstat (limited to 'Modules/_io')
-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 209aa13..6e706cd 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; } |