[Numpy-discussion] PyArg_ParseTuple

Ioan Ferencik ioan.ferencik@tkk...
Mon Oct 11 05:03:56 CDT 2010


I  would like to aks where can I find more detaile dinfo 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=<value optimized out>, 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 NumPy-Discussion mailing list