[Python-Dev] Stabilizing the C API of 2.6 and 3.0

Christian Heimes lists at cheimes.de
Sun May 25 16:59:24 CEST 2008


The first set of betas of Python 2.6 and 3.0 is fast apace. I like to
grab the final chance and clean up the C API of 2.6 and 3.0. I know, I
know, I brought up the topic two times in the past. But this time I mean
it for real! :]

Last time Guido said:
I think it can actually be simplified. I think maintaining binary
compatibility between 2.6 and earlier versions is hopeless anyway, so
we might as well just rename PyString to PyBytes in 2.6 and 3.0, and
have an extra set of macros so that code using PyString needs to be
recompiled but not otherwise touched. E.g.

typedef { ... } PyBytesObject;
#define PyStringObject PyBytesObject

... PyString_Type;
#define PyBytes_Type PyString_Type


I like to follow Guido's advice and change the code as following:

 * replace PyBytes_ with PyByteArray_
 * replace PyString with PyBytes_
 * rename bytesobject.[ch] to bytearrayobject.[ch]
 * rename stringobject.[ch] to bytesobject.[ch]
 * add a new file stringobject.h which contains the aliases PyString_ ->


More information about the Python-Dev mailing list