[Python-Dev] r87518 - python/branches/py3k/Parser/tokenizer.c (original) (raw)

Victor Stinner victor.stinner at haypocalc.com
Tue Dec 28 01:07:44 CET 2010


(oops, I posted an incomplete message, stupid mailer)

Le lundi 27 décembre 2010 à 22:22 +0100, Georg Brandl a écrit :

Am 27.12.2010 21:12, schrieb victor.stinner: > Author: victor.stinner > Date: Mon Dec 27 21:12:13 2010 > New Revision: 87518 > > Log: > Issue #10778: decodingfgets() decodes the filename from the filesystem > encoding instead of UTF-8. >

Hmm, and in case decoding fails, we return a Unicode error (without context) instead of a syntax error?

Yes, but it is very unlikely. I don't see in which case the decoder can fail. But a memory error can occur.

Doesn't seem like a good trade-off when the file name is just displayed in a message.

What do you suggest?

--

Prepare the decoded filename in PyParser_ParseStringFlagsFilenameEx() and PyParser_ParseFileFlagsEx() avoids this issue.

Victor



More information about the Python-Dev mailing list