[Pyrex] Initialisation of cdef global arrays with constants [resend]

Jani Hakala jahakala at cc.jyu.fi
Sat Jan 29 01:29:36 CET 2005


Jani Hakala <jahakala at cc.jyu.fi> writes:

>> Where I'm coming from is (my belief/understanding) that a "Python
>> function" hand coded in C _should_ return NULL in this circumstance,
>> so that the precise exception set by the called function can be
>> thrown, instead of a guess.
>>
> Python library has a global variable called Py_None that is returned
> instead of a null pointer. Even the reference count has to be
> incremented properly for Py_None before returning it as a return
> value. 
>
Oops, it is NULL in case of error. 

I checked the output from pyrex and putting 'raise' command seemed to 
generate code where 0 is returned. 

The test case was

def foo():
    raise "test"

I didn't compile this to a module...

Jani Hakala



More information about the Pyrex mailing list