diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-06-02 23:42:09 +0400 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-06-02 23:42:09 +0400 |
commit | d631abe4fe95589f31f6cb7f73aae24468ba3786 (patch) | |
tree | 3f613503f8d5e5c15cc7b5edf31af9ace06d8a5c /source/blender/python/api2_2x/gen_utils.h | |
parent | abd8fba47ff297574e9418bb1d951cc483751fba (diff) |
===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;
Diffstat (limited to 'source/blender/python/api2_2x/gen_utils.h')
-rw-r--r-- | source/blender/python/api2_2x/gen_utils.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/gen_utils.h b/source/blender/python/api2_2x/gen_utils.h index a4debf87d35..f9336282eef 100644 --- a/source/blender/python/api2_2x/gen_utils.h +++ b/source/blender/python/api2_2x/gen_utils.h @@ -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); |