[issue9076] Remove PyUnicode_AsDecodedObject/Unicode and PyUnicode_AsEncodedObject/Unicode?

Marc-Andre Lemburg report at bugs.python.org
Fri Jun 25 10:51:57 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>:
> 
> The following 4 functions are public but not documented and not used in Python3:
>  - PyUnicode_AsDecodedObject(), PyUnicode_AsEncodedObject()
>  - PyUnicode_AsDecodedUnicode(), PyUnicode_AsEncodedUnicode()
> 
> In Python2, PyUnicode_AsDecodedObject() was used by unicode.decode() method, but Python3 has no more str.decode() method (see the recent discussion on python-dev mailing list about .transform() / .untransform()).
> 
> In Python2, unicode.encode() uses PyUnicode_AsEncodedObject(), but in Python3 str.encode() uses PyUnicode_AsEncodedString() which ensures that the result type is bytes.
> 
> PyUnicode_AsDecodedUnicode() and PyUnicode_AsEncodedUnicode() were added by Marc-Andre Lemburg in r63986. These functions may be used for .transform() / .untranform() proposition, but this proposition is not yet accepted and the functions are now unused.
> 
> If you decide to keep one of these functions, the function have to be documented.

Victor, instead of always proposing to remove APIs that don't show
up in the C-API documentation, I'd much rather like to see documentation
patches from you, instead of patches that remove the APIs themselves.

Please also remember that we are still in a transition phase from
Python2 to Python3. The fact that Python3 (currently) doesn't use
an API does not mean that there's no Python2 3rd party code out
there using them, waiting to be ported to Python3.
It also doesn't mean that the APIs are useless.

The cases you are finding are documentation bugs. I don't want to
have to go through discussions about the usefulness of the APIs
each and every time you find one of those documentation bugs.

Furthermore, the above APIs are part of the codec system and
that doesn't have anything to do with some helper methods we have
or don't have on str and bytes objects.

Please also note that all these function *are* documented in the
unicodeobject.h header file.

----------
title: Remove PyUnicode_AsDecodedObject/Unicode and PyUnicode_AsEncodedObject/Unicode? -> Remove PyUnicode_AsDecodedObject/Unicode and	PyUnicode_AsEncodedObject/Unicode?

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


More information about the Python-bugs-list mailing list