Crash using Python 2.0 Extension

Mark Wilson m.wilson at bibliocraft.com
Thu Jan 25 18:22:56 EST 2001


Fredrik Lundh wrote:
>Py_INCREF(Py_None); /* get another reference to None */
>return Py_None; /* return an owned reference */

For me, this became tiresome, and I ended up with this:

inline PyObject*  Py_INCNONE( void )
    {
    Py_INCREF( Py_None );
    return( Py_None );
    }

as in:

PyObject*    FuncWhichReturnsNone( ...)
    {
    blah;
    blah;
    return( Py_INCNONE() );
    }

Just a small idea.

Mark









More information about the Python-list mailing list