[issue13608] remove born-deprecated PyUnicode_AsUnicodeAndSize

Marc-Andre Lemburg report at bugs.python.org
Tue Mar 27 09:22:16 CEST 2012

Marc-Andre Lemburg <mal at egenix.com> added the comment:

STINNER Victor wrote:
> STINNER Victor <victor.stinner at gmail.com> added the comment:
> The Py_UNICODE* type is deprecated but since Python 3.3, Py_UNICODE=wchar_t and wchar_t* is a common type on Windows. PyUnicode_AsUnicodeAndSize() is used to encode Python strings to call Windows functions.
> PyUnicode_AsUnicodeAndSize() is preferred over PyUnicode_AsWideCharString() because PyUnicode_AsWideCharString() stores the result in the Unicode string and the Unicode string releases the memory automatically later. Calling PyUnicode_AsWideCharString() twice on the same string avoids also the need of encoding the string twice because the result is cached.
> I proposed to add a new function using wchar_*t and storing the result in the Unicode string, but the idea was rejected. I don't remember why.

Could you please clarify what you actually intend to do ? Which
function do you want to remove and why ?

The title and description of this ticket don't match :-)

nosy: +lemburg

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list