===Python API===
Define macros for Py_RETURN_TRUE and Py_RETURN_FALSE (for Python 2.3). Also make Py_RETURN_NONE macro a little safer. Current macro will not work as expected in situations like below since it expands to two C statements: if( !attr ) Py_RETURN_NONE;
This commit is contained in:
@@ -50,7 +50,13 @@
|
||||
defined here until we switch to 2.4
|
||||
*/
|
||||
#ifndef Py_RETURN_NONE
|
||||
#define Py_RETURN_NONE Py_INCREF( Py_None ); return Py_None
|
||||
#define Py_RETURN_NONE return Py_BuildValue("O", Py_None)
|
||||
#endif
|
||||
#ifndef Py_RETURN_FALSE
|
||||
#define Py_RETURN_FALSE return PyBool_FromLong(0)
|
||||
#endif
|
||||
#ifndef Py_RETURN_TRUE
|
||||
#define Py_RETURN_TRUE return PyBool_FromLong(1)
|
||||
#endif
|
||||
|
||||
int EXPP_FloatsAreEqual(float A, float B, int floatSteps);
|
||||
|
||||
Reference in New Issue
Block a user