diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-06 09:39:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-06 11:09:53 +0300 |
commit | bf0c8e116db49379900020b5a20ba15d91b3fb9a (patch) | |
tree | c65b43084bde562dc2a08b5d88cb128f09028b6b /source/blender/python/intern/bpy_rna_anim.c | |
parent | 9fd569a654ded46901c7f20c5fe080972cbb10d2 (diff) |
PyAPI: add PyList_APPEND
This appends while giving ownership to the list, avoiding temp assignment.
This matches PyList_SET_ITEM which bypasses refcount's
Note, this also reduce code-size, Py_DECREF is a rather heavy macro.
Diffstat (limited to 'source/blender/python/intern/bpy_rna_anim.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna_anim.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index ed51ba5bd1f..ced7d6a5c1c 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -53,6 +53,8 @@ #include "bpy_util.h" #include "bpy_rna_anim.h" +#include "../generic/python_utildefines.h" + /* for keyframes and drivers */ static int pyrna_struct_anim_args_parse( PointerRNA *ptr, const char *error_prefix, const char *path, @@ -329,16 +331,13 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args) FCurve *fcu; PointerRNA tptr; - PyObject *item; if (index == -1) { /* all, use a list */ int i = 0; ret = PyList_New(0); while ((fcu = list_find_fcurve(&adt->drivers, path_full, i++))) { RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr); - item = pyrna_struct_CreatePyObject(&tptr); - PyList_Append(ret, item); - Py_DECREF(item); + PyList_APPEND(ret, pyrna_struct_CreatePyObject(&tptr)); } } else { |