Skip to content

Commit

Permalink
Fix: Compare ctx.value instead of ctx, fixes #2325 (#2326)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
cenkoloji authored and zack-vii committed Jun 21, 2021
1 parent ed9e72c commit 8852aa5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/MDSplus/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8852aa5

Please sign in to comment.