[New-bugs-announce] [issue9076] Remove PyUnicode_AsDecodedObject/Unicode and PyUnicode_AsEncodedObject/Unicode?

STINNER Victor report at bugs.python.org
Fri Jun 25 01:28:51 CEST 2010

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.

components: Unicode
files: remove_unicode_codec.patch
keywords: patch
messages: 108565
nosy: haypo, lemburg
priority: normal
severity: normal
status: open
title: Remove PyUnicode_AsDecodedObject/Unicode and PyUnicode_AsEncodedObject/Unicode?
versions: Python 3.2
Added file: http://bugs.python.org/file17763/remove_unicode_codec.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list