From af5690595c43f1b12cc06c423c75d0dcf9279be9 Mon Sep 17 00:00:00 2001 From: Cenk Yildiz Date: Mon, 21 Jun 2021 16:00:13 +0200 Subject: [PATCH 1/2] Compare ctx.value instead of ctx, fixes #2325 When instance of active tree is created (i.e. Tree()), comparing ctx of node and tree result in node seeming to be from another tree --- python/MDSplus/tree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/MDSplus/tree.py b/python/MDSplus/tree.py index f1ca8dbac8..7c090f3732 100644 --- a/python/MDSplus/tree.py +++ b/python/MDSplus/tree.py @@ -1047,7 +1047,7 @@ def setDefault(self, node): old = self.default if not isinstance(node, TreeNode): raise TypeError('default node must be a TreeNode') - if not node.ctx == self.ctx: + if not node.ctx.value == self.ctx.value: raise TypeError('TreeNode must be in same tree') _exc.checkStatus( _TreeShr._TreeSetDefaultNid(self.ctx, From be0a49cb0d4f244b1ae07579ce360e00a9abd40a Mon Sep 17 00:00:00 2001 From: Timo Schroeder Date: Mon, 21 Jun 2021 16:17:37 +0200 Subject: [PATCH 2/2] Update tree.py Consistently fix python ctypes.c_void_p compare --- python/MDSplus/tree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/MDSplus/tree.py b/python/MDSplus/tree.py index 7c090f3732..6bbc8c796a 100644 --- a/python/MDSplus/tree.py +++ b/python/MDSplus/tree.py @@ -694,7 +694,7 @@ def __deepcopy__(self, memo): def __eq__(self, obj): if isinstance(obj, (Tree,)): - return self.ctx == obj.ctx + return self.ctx.value == obj.ctx.value return False def __ne__(self, obj): return not self.__eq__(obj)