seg. fault with Py_BuildValue?
Diez B. Roggisch
deets at nospam.web.de
Thu May 29 09:44:26 EDT 2008
Christian Meesters wrote:
> Hi
>
> I'm having trouble with Py_BuildValue. I was able to pinpoint the
> following statement as the one causing a seg. fault with my script:
>
> static PyObject * funcname(PyObject *self, PyObject *args) {
> ...
> return Py_BuildValue("(OO)", x, y);
> }
> where x & y are both of type PyObject.
>
> Any suggestions here? Do I need to handle the output of Py_BuildValue
> somehow before returning? How? Need to decref x & y before returning?
Just a guess - but according to the docs of Py_BuildValue it will return a
tuple already when given a format string of several format units.
What happens if you get rid of the ()?
Diez
More information about the Python-list
mailing list