[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread David Beazley
David Beazley added the comment: Another note: the PyUnicode_AsUTF8String() doesn't leave the UTF-8 encoded byte string behind on the original string object. I got into this thinking that PyUnicode_AsWideCharString() might have similar behavior. -- ___

[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread David Beazley
David Beazley added the comment: Maybe it's not a bug, but I still think it's undesirable. Basically, you have a function that allocates a buffer, fills it with data, and allows the buffer to be destroyed. Yet, as a side effect, it allocates a second buffer, fills it, and permanently attac

[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread Martin v . Löwis
Martin v. Löwis added the comment: As stated, this is not a bug: there is no memory leak, nor any deviation from documented behavior. You are right that it fills the wstr pointer, by calling PyUnicode_AsUnicodeAndSize in unicode_aswidechar, and then copying the data to a fresh buffer. This i

[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread David Beazley
David Beazley added the comment: I should quickly add, is there any way to simply have this function not keep the wchar_t buffer around afterwards? That would be great. -- ___ Python tracker

[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread David Beazley
New submission from David Beazley: The PyUnicode_AsWideCharString() function is described as creating a new buffer of type wchar_t allocated by PyMem_Alloc() (which must be freed by the user). However, if you use this function, it causes the size of the original string object to permanently