Martin v. Löwis <mar...@v.loewis.de> added the comment:

We shouldn't need to reopen the file in the first place. If we already have a 
file handle, we can rewind it. Then the encoding of the file name becomes 
irrelevant.

I keep forgetting: what was the plan for deprecating the FILE* functions in the 
parser interface? If we need to continue to support them, we could read the 
whole contents of the file before parsing, and then use the memory-based 
parsing algorithm.

If parsing files can be fully based on the IO module, we shouldn't even need to 
rewind the file. Instead, the io module should support switching the encoding 
mid-stream (unless, say, we are in the middle of a multibyte character - since 
the parser always asks for complete lines, this should not happen).

----------
nosy: +loewis

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10095>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to