[Bf-python] use of EXPP_incr_ret_True() and EXPP_incr_ret_False()

Ken Hughes khughes at pacific.edu
Tue Aug 22 20:53:16 CEST 2006


Friendly reminder:

There are now two macros -- Py_RETURN_TRUE and Py_RETURN_FALSE -- which 
can be used in place of EXPP_incr_ret_True()/EXPP_incr_ret_False(). 
These macros exit from the calling function with True or False, while 
the EXPP_* only return a value which must explicitly be returned:

if( ok )
    Py_RETURN_TRUE;

versus

if( ok )
    return EXPP_incr_ret_True();

For new code, please use the macros instead of the EXPP_* functions. 
The same applies for Py_RETURN_NONE, which is now safe to use in "if" 
statements.  Prior to 2.42 it was not, so you would see this:

if( ok ) {
     Py_RETURN_NONE;
}

Ken



More information about the Bf-python mailing list