[issue2799] Remove PyUnicode_AsString(), rework PyUnicode_AsStringAndSize(), add PyUnicode_AsChar()

Martin v. Löwis report at bugs.python.org
Thu Jun 5 22:50:08 CEST 2008


Martin v. Löwis <martin at v.loewis.de> added the comment:

> How about PyUnicode_GetUTF8Buffer() or just PyUnicode_UTF8() ?!

-1

> Note that the function *must* check the UTF-8 buffer for embedded
> NUL bytes and then raise an exception if it finds one. Otherwise,
> the API would silently cause truncations.

PyString_AsString doesn't check for null bytes, either, and will also
silently truncate. This has never been a problem, so I fail to see why
it is a problem for Unicode strings.

----------
title: Remove PyUnicode_AsString(),	rework PyUnicode_AsStringAndSize(), add PyUnicode_AsChar() -> Remove PyUnicode_AsString(), rework PyUnicode_AsStringAndSize(), add PyUnicode_AsChar()

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2799>
_______________________________________


More information about the Python-bugs-list mailing list