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.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.c')
-rw-r--r-- | source/blender/python/intern/bpy.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index dbeccfdb8e6..ec3c017a7ed 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -51,6 +51,7 @@ #include "bpy_utils_units.h" #include "../generic/py_capi_utils.h" +#include "../generic/python_utildefines.h" /* external util modules */ #include "../generic/idprop_py_api.h" @@ -89,10 +90,7 @@ static PyObject *bpy_script_paths(PyObject *UNUSED(self)) static bool bpy_blend_paths_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src) { - PyObject *list = (PyObject *)userdata; - PyObject *item = PyC_UnicodeFromByte(path_src); - PyList_Append(list, item); - Py_DECREF(item); + PyList_APPEND((PyObject *)userdata, PyC_UnicodeFromByte(path_src)); return false; /* never edits the path */ } |