Problems sending list/tuple to a C extension.

Martin v. Löwis martin at v.loewis.de
Sun Nov 23 05:03:59 EST 2003


seberino at spawar.navy.mil (Christian Seberino) writes:

> I hope the mistake in this simple code is obvious to you:

There are two errors in your code:

>         PyArg_ParseTuple(args, "(i)", &a);

You MUST check the return value of PyArg_ParseTuple. Otherwise,
if it gives an exception, you just continue with incorrect data,
which is what happened here.

> >>> test.test( (3) )

This does NOT pass a tuple, but an integer only. Use (3,) to display a
tuple.

Regards,
Martin




More information about the Python-list mailing list