[issue8923] Remove unused "errors" argument from _PyUnicode_AsDefaultEncodedString()

Marc-Andre Lemburg report at bugs.python.org
Wed Jun 9 13:14:00 CEST 2010


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

STINNER Victor wrote:
> 
> STINNER Victor <victor.stinner at haypocalc.com> added the comment:
> 
>> Since Python3 fixes the UTF-8 default encoding, it's better
>> to enhance PyUnicode_AsUTF8String() to cache the UTF-8
>> string in the Unicode object
> 
> Right, that sounds like a great idea. Attached patch implements that: patch PyUnicode_AsUTF8String() and PyUnicode_AsEncodedString(). Does it look ok?

Looks good.

>> replace all uses of _PyUnicode_AsDefaultEncodedString() 
>> with PyUnicode_AsUTF8String()
> 
> I'm waiting for your approval of the first patch before working on the second part.

When replacing uses of _PyUnicode_AsDefaultEncodedString() with
PyUnicode_AsUTF8String() you have to take great care to decref
the object returned by the latter. Otherwise, we get huge memory
leaks.

----------
title: Remove unused "errors" argument from	_PyUnicode_AsDefaultEncodedString() -> Remove unused "errors" argument	from	_PyUnicode_AsDefaultEncodedString()

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


More information about the Python-bugs-list mailing list