[Python-Dev] PyArg_ParseTuple (original) (raw)

Ioan Ferencik ioan.ferencik at tkk.fi
Mon Oct 11 14:06:48 CEST 2010


I would like to ask where can I find more detailed info on PyArg_ParseTuple function.

I find the doc limited on the matter. Mainly I am curious why the function requires an address of a pointer.

I have issues in the following case: in python int jmax = 16

print type(jmax)

<type 'int'>

which is just all right but following C code seems to be working PyObject *jmax_o = NULL;

if(!PyArg_ParseTuple(args, "i", &jmax_o)){ goto error; }

but PyInt_Check(jmax_o) fails.

I tried to debug and this is what i could see

Program received signal SIGSEGV, Segmentation fault. 0x00007ffff67a75bd in fprintf (self=, args=(16,)) at /usr/include/bits/stdio2.h:98 98 return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,

so for some reason the jmax_o can not be converted to int.

I use a x86_64 ubuntu and i suspect it could be because of 64 bits arch.

Cheers

Ioan Ferencik PhD student Aalto University School of Science and Technology Faculty Of Civil and Env. Engineering Lahti Center Tel: +358505122707



More information about the Python-Dev mailing list