On 8/7/07, Thomas Heller <[EMAIL PROTECTED]> wrote: > Guido van Rossum schrieb: > > test_ctypes > > Recently one test started failing again, after Martin changed > > PyUnicode_FromStringAndSize() to use UTF8 instead of Latin1. > > I wanted to look into this and noticed that 'import time' on Windows > doesn't work anymore on my machine. The reason is that > PyUnicode_FromStringAndSize() > is called for the string 'Westeuropäische Normalzeit', and then fails with > > UnicodeDecodeError: 'utf8' codec can't decode bytes in position 9-11: invalid > data
I'm assuming that's a literal somewhere? In what encoding is it? That function was recently changed to require the input to be UTF-8. If the input isn't UTF-8, you'll have to use another API with an explicit encoding, PyUnicode_Decode(). I'm pretty sure this change is also responsible for the one failure (as it started around the time that change was made) but I don't understand the failure well enough to track it down. (It looked like uninitialized memory was being accessed though.) In case you wonder why it was changed, it's for symmetry with _PyUnicode_AsDefaultEncodedString(), which is the most common way to turn Unicode back into a char* without specifying an encoding. (And yes, that name needs to be changed.) See recent posts here. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
