[3.6] bpo-25862: Fix assertion failures in io.TextIOWrapper.tell(). (GH-3918) by ZackerySpytz · Pull Request #8012 · python/cpython

Expand Up @@ -696,6 +696,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. */
Expand Down Expand Up @@ -1367,6 +1370,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) { Expand Down Expand Up @@ -1602,6 +1606,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; } Expand Down