classification
Title: Py_UCS4_strlen and friends needn't be public
Type: Stage: resolved
Components: Documentation Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, ezio.melotti, georg.brandl, loewis, pitrou, python-dev, vstinner
Priority: release blocker Keywords:

Created on 2011-10-22 20:13 by pitrou, last changed 2011-10-31 07:41 by python-dev. This issue is now closed.

Messages (6)
msg146187 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-22 20:13
It seems there's no reason to document these functions which operate on null-terminated unicode arrays.
msg146191 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-10-22 20:55
If they aren't public, they should get an underscore.

All our API functions are either public or private; all public ones should be documented.
msg146221 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-10-23 09:08
> It seems there's no reason to document these functions
> which operate on null-terminated unicode arrays.

It's the easiest way to create a new string with the new Unicode API, when it's difficult to predict the exact output length and maximum character:

Py_UCS4 *buffer = PyMem_Malloc(...);
...
str = PyUnicode_FromKindAndBuffer(buffer, PyUnicode_4BYTE_KIND);
PyMem_Free(buffer);

PyUCS4_* functions are useful in the "..." (to write characters, expecially when you manipulate multiple strings).

For examples, see Python/import.c which used char*, then Py_UNICODE* and now Py_UCS4*. It's maybe possible to avoid functions like xxx_strlen(), but it was easier to replace str*() functions by Py_UNICODE_* and then PyUCS4_* functions.

--

Py_UNICODE_* and PyUCS4_* functions are not part of the stable API.
msg146229 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2011-10-23 12:30
Before the release, we should consider whether we can drop these functions altogether.
msg146231 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-10-23 12:40
Making sure we don't forget that :)
msg146677 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-10-31 07:41
New changeset 80a7ab9ac29f by Martin v. Löwis in branch 'default':
Drop Py_UCS4_ functions. Closes #13246.
http://hg.python.org/cpython/rev/80a7ab9ac29f
History
Date User Action Args
2011-10-31 07:41:15python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg146677

resolution: fixed
stage: resolved
2011-10-23 12:40:31georg.brandlsetpriority: normal -> release blocker

messages: + msg146231
2011-10-23 12:30:07loewissetmessages: + msg146229
2011-10-23 09:08:29vstinnersetmessages: + msg146221
2011-10-22 20:55:13georg.brandlsetmessages: + msg146191
2011-10-22 20:13:50pitroucreate