Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Hughes <khughes@pacific.edu>2006-06-02 23:42:09 +0400
committerKen Hughes <khughes@pacific.edu>2006-06-02 23:42:09 +0400
commitd631abe4fe95589f31f6cb7f73aae24468ba3786 (patch)
tree3f613503f8d5e5c15cc7b5edf31af9ace06d8a5c /source/blender/python/api2_2x/gen_utils.h
parentabd8fba47ff297574e9418bb1d951cc483751fba (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.h8
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);