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

M.-A. Lemburg mal at egenix.com
Mon May 26 15:29:07 CEST 2008


On 2008-05-25 16:59, Christian Heimes wrote:
> Hello!
> 
> 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
> 
> <etc>
> ---
> 
> 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_ ->
> PyBytes_

Since this is major break in the Python C API, please make sure
that you bump the Python C API level used for module imports.

Most imports will fail anyway at the link stage, since PyString_* APIs
are probably the most used C APIs in Python extensions.

One detail, I'm worried about is the change of the type name, since
that is sometimes used in object serialization or proxy implementations.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, May 26 2008)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2008-07-07: EuroPython 2008, Vilnius, Lithuania            41 days to go

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::


    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
            Registered at Amtsgericht Duesseldorf: HRB 46611


More information about the Python-Dev mailing list