diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-06 08:42:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-06 11:09:11 +0300 |
commit | 9fd569a654ded46901c7f20c5fe080972cbb10d2 (patch) | |
tree | 933b893aeaa0a8bffe230933523512340dfa016d /source/blender/python/intern/bpy_app_handlers.c | |
parent | ee58d449455df9470c4a0a902056b8c2001128bf (diff) |
PyAPI: add utilities PyTuple_SET_ITEMS, Py_INCREF_RET
Setting all values of a tuple is such a common operation that it deserves its own macro.
Also added Py_INCREF_RET to avoid confusing use of comma operator.
Diffstat (limited to 'source/blender/python/intern/bpy_app_handlers.c')
-rw-r--r-- | source/blender/python/intern/bpy_app_handlers.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index cf20f6fa742..6a8b0b065c2 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -37,6 +37,8 @@ #include "bpy_rna.h" #include "bpy_app_handlers.h" +#include "../generic/python_utildefines.h" + #include "BPY_extern.h" void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg); @@ -306,8 +308,7 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar PyTuple_SET_ITEM(args, 0, pyrna_struct_CreatePyObject(&id_ptr)); } else { - PyTuple_SET_ITEM(args, 0, Py_None); - Py_INCREF(Py_None); + PyTuple_SET_ITEM(args, 0, Py_INCREF_RET(Py_None)); } /* Iterate the list and run the callbacks |