Skip to content

Commit

Permalink
Make sure that the memory is released when a collection goes out of s…
Browse files Browse the repository at this point in the history
…cope in Python
  • Loading branch information
jesper-friis committed Nov 9, 2024
1 parent 89dceb5 commit 227e61a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 1 addition & 5 deletions bindings/python/dlite-collection-python.i
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,7 @@ class Collection(Instance):
is registered, a DLiteError is raised.
"""
inst = _collection_get_new(self._coll, label, metaid)
if inst.is_meta:
inst.__class__ = Metadata
elif inst.meta.uri == COLLECTION_ENTITY:
inst.__class__ = Collection
return inst
return instance_cast(inst)

def get_id(self, id):
"""Return instance with given id."""
Expand Down
3 changes: 1 addition & 2 deletions bindings/python/dlite-collection.i
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ const struct _Triple *
int dlite_collection_add(struct _DLiteCollection *coll, const char *label,
struct _DLiteInstance *inst);
int dlite_collection_remove(struct _DLiteCollection *coll, const char *label);
//const struct _DLiteInstance *
// dlite_collection_get(const struct _DLiteCollection *coll, const char *label);
%newobject dlite_collection_get_new;
struct _DLiteInstance *
dlite_collection_get_new(const struct _DLiteCollection *coll,
const char *label, const char *metaid);
Expand Down

0 comments on commit 227e61a

Please sign in to comment.