You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Calling TextIOWrapper.tell() in the middle of reading a gb2312-encoded file causes UnicodeDecodeError #84596
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2020-05-03.09:14:03.853>created_at=<Date2020-04-28.04:33:56.399>labels= ['expert-unicode', '3.7', 'expert-IO', 'type-crash']
title='Calling TextIOWrapper.tell() in the middle of reading a gb2312-encoded file causes UnicodeDecodeError'updated_at=<Date2020-05-03.09:14:03.851>user='https://github.com/rmalouf'
The commit referenced above is for bpo-33578. The symptoms for that issue were very similar, including involving a cjk codec. The change was not backported because it was seen an enhancement. Rob, if you try 3.8.2 or 3.8.3 (the release candidate was out Wednesday, the final probably next week or so) and still have the same problem, re-open this.
Activity
rmalouf commentedon Apr 28, 2020
Calling TextIOWrapper.tell() while reading the attached gb2312-encoded file like this:
gives this result:
The file seems to be well-formed and can be read without any problem. It's only the call to tell() that raises an issue.
terryjreedy commentedon May 1, 2020
OS? in case it matters
terryjreedy commentedon May 1, 2020
Change the line to 'print(f.tell())'. Are any lines printed before the error?
rmalouf commentedon May 2, 2020
Same results on MacOS 10.15.4 (both the system python and the intel/anaconda version) and on CentOS 7.8
Here's the output with print(...):
animalize commentedon May 3, 2020
On Windows 10, Python 3.7, I get the same message as above reply.
If use Python 3.8, it works well.
animalize commentedon May 3, 2020
I did a git bisect, this commit fixed the bug:
ac22f6a
methane commentedon May 3, 2020
I think this is not a bug, but a limitation of Python 3.7, and improvement in 3.8.
terryjreedy commentedon May 3, 2020
The commit referenced above is for bpo-33578. The symptoms for that issue were very similar, including involving a cjk codec. The change was not backported because it was seen an enhancement. Rob, if you try 3.8.2 or 3.8.3 (the release candidate was out Wednesday, the final probably next week or so) and still have the same problem, re-open this.