summaryrefslogtreecommitdiffstats
path: root/libdimension-python
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension-python')
-rw-r--r--libdimension-python/dimension.pxd1
-rw-r--r--libdimension-python/dimension.pyx13
2 files changed, 6 insertions, 8 deletions
diff --git a/libdimension-python/dimension.pxd b/libdimension-python/dimension.pxd
index 6579c89..a7b8a53 100644
--- a/libdimension-python/dimension.pxd
+++ b/libdimension-python/dimension.pxd
@@ -54,6 +54,7 @@ cdef extern from "../libdimension/dimension.h":
ctypedef struct dmnsn_array
dmnsn_array *dmnsn_new_array(size_t objsize)
+ dmnsn_array *dmnsn_palloc_array(dmnsn_pool *pool, size_t objsize)
void dmnsn_delete_array(dmnsn_array *array)
size_t dmnsn_array_size(dmnsn_array *array)
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index d3f880c..0c4d665 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -1283,17 +1283,14 @@ cdef class Union(Object):
if len(objects) < 1:
raise TypeError("expected a list of one or more Objects")
- cdef dmnsn_array *array = dmnsn_new_array(sizeof(dmnsn_object *))
+ cdef dmnsn_array *array = dmnsn_palloc_array(_get_pool(), sizeof(dmnsn_object *))
cdef dmnsn_object *o
- try:
- for obj in objects:
- o = (<Object?>obj)._object
- dmnsn_array_push(array, &o)
+ for obj in objects:
+ o = (<Object?>obj)._object
+ dmnsn_array_push(array, &o)
- self._object = dmnsn_new_csg_union(_get_pool(), array)
- finally:
- dmnsn_delete_array(array)
+ self._object = dmnsn_new_csg_union(_get_pool(), array)
Object.__init__(self, *args, **kwargs)