Robert Bradshaw wrote:
> On Aug 19, 2008, at 7:53 AM, Stefan Behnel wrote:
>
>   
>> Andrew Straw wrote:
>>     
>>> Hi, looking at the Cython Sphinx documentation, I don't see the  
>>> Python
>>> version as a variable I can use for conditional compilation. This  
>>> would
>>> be handy in the case of newly added features in the Python-C API, for
>>> example. Would this be feasible to add (alongside UNAME_SYSNAME and
>>> friends)?
>>>       
>> Feasible, yes, but it doesn't make much sense to check the Python  
>> version
>> at Cython compile time. The C code that gets generated by Cython  
>> will run
>> on all Python versions from 2.3 to 3.0, and on all major platforms.  
>> You
>> will loose that if you start generating platform-specific C code  
>> for the
>> system that happens to run Cython on your code.
>>     
>
>   
Fair enough. But doesn't the UNAME_SYSNAME also make the C code 
platform-specific? (Not that one step down a slippery slope is an 
argument to take another. In fact, as noted below, my desire for this 
feature has dropped to near zero.)

> If you want to do this I would recommend putting them in an actual .h  
> file (with a cdef extern import block) so that the resulting .c files  
> could be used on multiple Python versions.
>   
Yes, that was my thought as well. But, I'm spoiled by not having to 
write C code with Cython/Pyrex, so I get lazy. Particularly when I 
noticed UNAME_SYSNAME, which should allow me to drop the .h file I had 
already written.
> Out of curiosity, what of the Python/C API do you need? (I'd rather  
> to fix Cython to not have to directly call it.)
>   
I'm looking into PEP 3118 at the moment. I now see the Dag has sort of 
backported a Cython-ified version of it, though,
so in fact I'm dropping my pursuit of the Python/C API in favor of 
testing the cython-devel branch. This looks very exciting. :)

-Andrew
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to