[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>
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index f022a4e..98c2d58 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -1619,6 +1619,7 @@
         self.buffer.write(b)
         if self._line_buffering and (haslf or "\r" in s):
             self.flush()
+        self._set_decoded_chars('')
         self._snapshot = None
         if self._decoder:
             self._decoder.reset()