Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18761

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

From Stefan Behnel <stefan_ml@behnel.de>
Subject Re: C-API: Pass a tuple to a method of a class
Date 2012-01-10 15:05 +0100
References <ea-mime-4f0c19a2-3df4-7b628f3f@webmail.numericable.fr> <jehb6d$ijh$1@dough.gmane.org> <jehcra$ut6$1@dough.gmane.org> <CAGZyxufS1tzjDmpu3xBDKsKOL8ncaSrQCOC_MiBHp2cb+tpTnA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4596.1326204337.27778.python-list@python.org> (permalink)

Show all headers | View raw


[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.

http://docs.cython.org/src/userguide/language_basics.html#error-return-values


> 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:

http://docs.cython.org/src/userguide/external_C_code.html#using-cython-declarations-from-c

Stefan

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: C-API: Pass a tuple to a method of a class Stefan Behnel <stefan_ml@behnel.de> - 2012-01-10 15:05 +0100

csiph-web