[Python-Dev] Any PEP about 2.6 -> 3000 code transition?
Stefan Behnel
stefan_ml at behnel.de
Sun May 25 09:59:55 CEST 2008
Gregory P. Smith wrote:
> Of particular interest to bsddb is the pep3118 buffer API. I updated
> the existing bsddb module found in the py3k branch to use it last
> fall; you may want to use the changes made to it as an example.
>
> I agree, a single C code base is the only sane way forward for bsddb.
> The interesting part is that you also want to support older python
> versions (2.3-2.5?) as well so _bsddb.c & bsddb.h become a nice
> example of how to write code that spans multiple python versions.
>
> I expect it is less difficult than it sounds.
I would say so. Most things can be done with preprocessor conditionals and
some redefinitions, e.g. "#define PyLong_Type PyInt_Type", etc.
The method "generate_module_preamble()" in Cython's ModuleNode.py source file
(from line 360 onwards) has a code block of things we found so far.
http://hg.cython.org/cython-devel/file/tip/Cython/Compiler/ModuleNode.py
> I believe the buffer api is supposed to be backported to 2.6? I
> haven't followed the status of that. If so, bsddb should use it in
> 2.6 as well.
The API is there (in addition to the old buffer API), but it doesn't seem to
get used.
Stefan
More information about the Python-Dev
mailing list