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/mathutils/mathutils_geometry.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/mathutils/mathutils_geometry.c')
-rw-r--r-- | source/blender/python/mathutils/mathutils_geometry.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 261234e6aae..da46af8a847 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1061,10 +1061,7 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a if (l == len) { /* ok */ /* python */ - PyObject *item = Vector_CreatePyObject(potentialVertex, 3, NULL); - PyList_Append(py_verts, item); - Py_DECREF(item); - + PyList_APPEND(py_verts, Vector_CreatePyObject(potentialVertex, 3, NULL)); planes_used[i] = planes_used[j] = planes_used[k] = true; } } @@ -1080,9 +1077,7 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a /* now make a list of used planes */ for (i = 0; i < len; i++) { if (planes_used[i]) { - PyObject *item = PyLong_FromLong(i); - PyList_Append(py_plane_index, item); - Py_DECREF(item); + PyList_APPEND(py_plane_index, PyLong_FromLong(i)); } } PyMem_Free(planes_used); |