bpo-25862: Fix an assertion failure in io.TextIOWrapper.tell().#3918
Conversation
33e3a5e to
5fd8540
Compare
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Thank you for your PR @ZackerySpytz. It fixes the original case. But there are other similar cases, and it would be nice to fix them in a single issue. It is enough to fix tell() after write(). Other cases look less rare and more complex. They can be fixed in separate PRs.
|
|
||
| def test_issue25862(self): | ||
| # tell() shouldn't cause an assertion failure if called after read(). | ||
| t = self.TextIOWrapper(self.BytesIO(b'test')) |
There was a problem hiding this comment.
The encoding depends on the environment. This can affect the test. It is better to specify the encoding explicitly.
eac030f to
d00fa36
Compare
d00fa36 to
3066cf8
Compare
|
Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7. |
|
GH-8007 is a backport of this pull request to the 3.7 branch. |
|
Sorry, @ZackerySpytz and @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry, @ZackerySpytz and @serhiy-storchaka, I could not cleanly backport this to |
…ythonGH-3918). (cherry picked from commit 23db935) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
|
GH-8012 is a backport of this pull request to the 3.6 branch. |
…ythonGH-3918). (cherry picked from commit 23db935) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
|
GH-8013 is a backport of this pull request to the 2.7 branch. |
Calling
read()can callPy_CLEAR(self->snapshot), butself->decoded_charsis not set toNULLin this case. This can cause an assertion failure intell().https://bugs.python.org/issue25862