Problem in PyArg_ParseTuple on python 2.5.2 with AIX

abhi abhigyan_agrawal at in.ibm.com
Mon Jul 27 03:11:42 EDT 2009


Hi,
    I am facing a problem using PyArg_ParseTuple() in my C-API
extension. Here is a small repro of the function:

static PyObject *parsetuple_test(PyObject *self, PyObject *args)
{
	SQLUSMALLINT param_no = 0;
	PyObject *py_obj = NULL;

	if (!PyArg_ParseTuple(args, "Oi", &py_obj, &param_no)){

		return NULL;
	}
	printf("%d\n", param_no);
	return NULL;
}

This function works fine and prints the correct value passed
(param_no) when I test it on Linux or Windows. However, it always
prints 0 (initial value defined in function) when I run it on AIX.

I think the problem is with "Oi" argument, if I replace that with "OO"
and specifically convert it integer/sqlsmallint. It works fine on AIX,
but I want to use "i" and not "O".

Any ideas on what is the reason behind the problem and how to fix
this?

Thanks,
Abhigyan



More information about the Python-list mailing list