C-API: Pass a tuple to a method of a class

Stefan Behnel stefan_ml at behnel.de
Tue Jan 10 09:05:20 EST 2012

[cleaned up top-posted citation order to make the replies readable]

刘振海, 10.01.2012 14:24:
> 2012/1/10 Stefan Behnel
>> """
>> # in module "gluecode.pyx" (or whatever you want to name it)
>> import mModule8
>> cdef api float compute_norm(float init_value, float x, float y, float z):
>>    vec = mModule8.cVector(init_value)
>>    return vec.ComputeNorm( (x,y,z) )
>> """

I just noticed that this swallows exceptions. It should have one of the
"except" declarations at the end of the signature to enable proper
exception signalling to the calling C/C++ code.


> I have been using Cython for a period of time. But I can not find a
> description for the "api" key word in Cython documents

I admit that searching for "api" isn't really helpful here, but at least
the page on "interfacing with external C code" shouldn't be all that hard
to find in the given context. It contains this section:



More information about the Python-list mailing list