summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-06-29 14:07:13 -0600
committerSerhiy Storchaka <storchaka@gmail.com>2018-06-29 23:07:13 +0300
commit0464de0f9a226cfa32b803e0326c12b2432aba26 (patch)
treed4c456790417ad6aeed6f5fd732546d3d3dbc001 /Modules
parent11ba050986b96701f72f1356d22adde8c7dbf211 (diff)
downloadcpython-git-0464de0f9a226cfa32b803e0326c12b2432aba26.tar.gz
[2.7] bpo-25862: Fix assertion failures in io.TextIOWrapper.tell(). (GH-3918). (GH-8013)
(cherry picked from commit 23db935bcf258657682e66464bf8512def8af830) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_io/textio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index bf37f72bd1..1979539cc0 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -707,6 +707,8 @@ 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. */
@@ -1329,6 +1331,7 @@ textiowrapper_write(textio *self, PyObject *args)
Py_DECREF(ret);
}
+ textiowrapper_set_decoded_chars(self, NULL);
Py_CLEAR(self->snapshot);
if (self->decoder) {
@@ -1534,6 +1537,7 @@ textiowrapper_read(textio *self, PyObject *args)
if (final == NULL)
goto fail;
+ textiowrapper_set_decoded_chars(self, NULL);
Py_CLEAR(self->snapshot);
return final;
}