Skip to content

Commit 2e2309c

Browse files
committed
delete only root node
1 parent ff50550 commit 2e2309c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libyang/data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,10 @@ def __init__(self, context: "libyang.Context", cdata):
292292
self.free_func = None # type: Callable[DNode]
293293

294294
def __del__(self):
295-
self.free()
295+
# Delete only the root node when it goes out of scope, this will delete
296+
# all children.
297+
if node.parent() is None:
298+
self.free()
296299

297300
def meta(self):
298301
ret = {}

0 commit comments

Comments
 (0)