STINNER Victor <victor.stin...@haypocalc.com> added the comment:

The problem is the cast char => Py_UNICODE in formatchar() function. char may 
be unsigned, but most of the time it's signed. signed => unsigned cast extend 
the sign. Example: (unsigned short)(signed char)0x80 gives 0xFF80.

Attached patch fixes the issue and includes an unit test.

----------
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file15768/unicode_formatchar.patch

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

Reply via email to