[issue10095] Support undecodable filenames in the parser API

Martin v. Löwis report at bugs.python.org
Thu Oct 14 09:17:01 CEST 2010


Martin v. Löwis <martin at 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 <report at bugs.python.org>
<http://bugs.python.org/issue10095>
_______________________________________


More information about the Python-bugs-list mailing list