This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add C-API documentation for PyUnicode_AsDecodedObject/Unicode and PyUnicode_AsEncodedObject/Unicode
Type: Stage:
Components: Documentation Versions: Python 3.2
process
Status: closed Resolution: out of date
Dependencies: Superseder: Document unicode C-API in reST
View: 10435
Assigned To: docs@python Nosy List: docs@python, georg.brandl, lemburg, vstinner
Priority: normal Keywords: patch

Created on 2010-06-24 23:28 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
remove_unicode_codec.patch vstinner, 2010-06-24 23:28 review
Messages (3)
msg108565 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-06-24 23:28
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.
msg108581 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2010-06-25 08:51
STINNER Victor wrote:
> 
> New submission from STINNER Victor <victor.stinner@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.
msg121305 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-11-16 16:31
Documenting Unicode C APIs is now tracked in #10435.
History
Date User Action Args
2022-04-11 14:57:02adminsetgithub: 53322
2010-11-16 16:31:41georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg121305

superseder: Document unicode C-API in reST
resolution: out of date
2010-06-25 08:53:09lemburgsettitle: Remove PyUnicode_AsDecodedObject/Unicode and PyUnicode_AsEncodedObject/Unicode? -> Add C-API documentation for PyUnicode_AsDecodedObject/Unicode and PyUnicode_AsEncodedObject/Unicode
2010-06-25 08:52:38lemburgsetassignee: docs@python

components: + Documentation, - Unicode
nosy: + docs@python
2010-06-25 08:51:55lemburgsetmessages: + msg108581
title: Remove PyUnicode_AsDecodedObject/Unicode and PyUnicode_AsEncodedObject/Unicode? -> Remove PyUnicode_AsDecodedObject/Unicode and PyUnicode_AsEncodedObject/Unicode?
2010-06-24 23:28:49vstinnercreate