Crash using Python 2.0 Extension
Alex Martelli
aleaxit at yahoo.com
Thu Jan 25 14:22:50 EST 2001
"Ken Koller" <kkoller at newfocus.com> wrote in message
news:3A707199.FBDF1A81 at newfocus.com...
> Hi,
>
> I originally wrote the routine below to return Py_None, but the
> interpretter would crash after calling the routine several times (maybe
> 100-200) in a row. At first I thought it had something to do with the
You need to increment-reference the object you're returning,
even if it's Py_None; seems you aren't doing it.
> return Py_BuildValue("i", 0);
Or just return Py_BuildValue("") -- this is also a way to return
an incref'd None, not quite as fast as doing it directly but more
compact and perhaps handier.
Alex
More information about the Python-list
mailing list