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

Marc-Andre Lemburg report at bugs.python.org
Mon Jun 7 23:37:07 CEST 2010


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

STINNER Victor wrote:
> 
> New submission from STINNER Victor <victor.stinner at haypocalc.com>:
> 
> _PyUnicode_AsDefaultEncodedString() has two arguments: unicode (input string) and errors. If errors is not NULL, it calls Py_FatalError()!
> 
> The argument is useful: all functions call it with errors=NULL.
> 
> Attached patch removes the argument.

While it's an internal API, it's still public and we cannot
just remove the extra argument - we're in stable branch mode.

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 or simply return it directly
and then replace all uses of _PyUnicode_AsDefaultEncodedString()
with PyUnicode_AsUTF8String().

We should phase out use of _PyUnicode_AsDefaultEncodedString()
as well as the whole default encoding terminology altogether.

Please also add a documentation patch and a NEWS entry.

----------
nosy: +lemburg
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