[Python-3000] string C API

Jim Jewett jimjjewett at gmail.com
Wed Sep 13 15:34:47 CEST 2006

On 9/13/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> Fredrik Lundh schrieb:
> > just noticed that PEP 3100 says that PyString_AsEncodedString and
> > PyString_AsDecodedString is to be removed, but it doesn't mention
> > any other PyString (or PyUnicode) functions.

> > how large changes can we make here, really ?

> All API that refers to the internal representation should be
> changed or removed; in theory, that could be all API that has
> char* arguments.

This is sufficient to allow polymorphic strings -- including strings
whose data is implemented as a view into some other object.

> For example, PyString_From{String[AndSize]|Format} would either:
> - have to grow an encoding argument
> - assume a default encoding (either ASCII or UTF-8)
> - change its signature to operate on Py_UNICODE* (although
>   we don't have literals for these) or
> - be removed

Should encoding be an attribute of the string?

If so, should recoding require the creation of a new string (in the
new encoding)?


More information about the Python-3000 mailing list