[Pyrex] Python 3

Robert Bradshaw robertwb at math.washington.edu
Mon Apr 28 19:05:27 CEST 2008


On Apr 28, 2008, at 7:49 AM, Helmut Jarausch wrote:

> Hi,
>
> I've just noticed that there is currently a thread on the Python3k
> mailing list about C-extensions.
>
> It looks as if SWIG needs some functionality which isn't
> available any longer, e.g.
>
>    From: Alex Martelli <aleaxit at gmail.com>
>  Subject: Re: [Python-3000] Binding builtin function to class
>     Date: Mon, 28 Apr 2008 07:14:10 -0700
>       To: Haoyu Bai <divinekid at gmail.com>
>       Cc: python-3000 at python.org
>
> On Mon, Apr 28, 2008 at 4:14 AM, Haoyu Bai <divinekid at gmail.com>  
> wrote:
>    ...
>>  Yes, these are the very problems I encountered. I think the using of
>> "new.instancemethod" is for speed, because in SWIG's command line,  
>> the
>> "-fastproxy" option enabled it:
>>
>>  -fastproxy      - Use fast proxy mechanism for member methods
>>
>>  So what we expect is to find a way doing this in Python 3, as  
>> fast as the
>> "new.instancemethod".
>
> Essentially a descriptor type with a suitable __get__, right?  And
> C-coded if it needs to be that fast. Is this a SWIG-specific issue (so
> that SWIG can take care of it in the C code it generates or links) or
> sufficiently general to warrant an addition to the Python core?
> Instinctively I think the latter, but can't easily think of another
> usecase beyond SWIG (and perhaps similar tools such as Boost or SIP).
>
> Alex
> -----------------------------------
>
> What about pyrex / cython ?
>
> Perhaps it's not too late to get a foot into the door of Python 3
> if pyrex/cython needs some functionality which is currently lost
> in Python 3.
>
> Many thanks to you working on Pyrex/Cython.
> Helmut.

This is something we are looking into, and there has been a fair  
amount of work put into this already. The Python 3 C/API is on track  
to be stable by June, which will coincide with Sage Dev Days http:// 
wiki.sagemath.org/dev1 which has Cython enhancement as a major goal.

There is a bare-bones page up at http://wiki.cython.org/enhancements/ 
3000 which is the place to keep track of the things we need to do to  
get ready for Python 3. The unicode issues have been hashed out in  
the thread at http://codespeak.net/pipermail/cython-dev/2008-April/ 
000470.html . Basically, this means

     cdef char* s = o

would become illegal for unicode objects o.

- Robert




More information about the Pyrex mailing list