[issue7330] PyUnicode_FromFormat segfault
STINNER Victor
report at bugs.python.org
Fri Feb 18 16:05:33 CET 2011
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
> Oh, what if the trunked char* cannot be decoded correctly?
> e.g. a tow-bytes character is divided in the middle?
Yes, but PyUnicode_FromFormatV() uses UTF-8 decoder with replace error handler, and so the incomplete byte sequence will be replaced by � (it doesn't fail with an error). Example:
>>> "abc€".encode("utf-8")[:-1].decode("utf-8", "replace")
'abc�'
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7330>
_______________________________________
More information about the Python-bugs-list
mailing list