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

2012-01-10 Thread pasparis
Py_BuildValue("(O)", pTuple);  if (args == NULL) {    Py_DECREF(args);    error("Can't build argument list for class instance");  }    // Call our object method with arguments   ret = PyEval_CallObject(method,args); ---- Message d'origine De : paspa...@noos.fr À : p

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

2012-01-10 Thread Stefan Behnel
[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): >>ve

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

2012-01-10 Thread 刘振海
Hi, 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 cdef api float compute_norm(float init_value, float x, float y, float z): Can you explain it a little bit? Thanks! Regards, Liu Zhenhai 2012/1/10 Stefan Behnel > Hi a

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

2012-01-10 Thread Stefan Behnel
Hi again, just as a little teaser, to make it clear that I'm not joking, here's your code below translated into Cython. Stefan Behnel, 10.01.2012 13:33: > paspa...@noos.fr, 10.01.2012 11:57: >> the code is the following: > [...] >> // Class >> pclass = PyObject_GetAttrString(mymod, "cVector"); >>

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

2012-01-10 Thread Stefan Behnel
Hi! paspa...@noos.fr, 10.01.2012 11:57: > I am trying to pass a tuple to a method of a class from C++ to Python. I get > a > Run Failed from the execution. > thanks for help/suggestions My *suggestion* is to use Cython instead of writing the glue code yourself. There are several bugs and lots o

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

2012-01-10 Thread pasparis
HelloI am trying to pass a tuple to a method of a class from C++ to Python. I get a Run Failed from the execution. thanks for help/suggestionsthe code is the following:Python Code:class cVector:  def __init__(self,msg):    self.value = msg  def ComputeNorm(self,vecData):    #don't use vecData for