Open
Description
I' not sure is this a bug or not. Maybe someone can give me some hint to fix this problem.
Describe the bug
I have a custom Node object with the following structure:
class Node():
def __init__(self, row, level):
self.level = level
self.DESC = row['Description']
self.id = {
'HP': row[col_by_level[level][0]],
'IEC': row[col_by_level[level][1]],
}
self.Quantity = row['Quantity']
self.children = []
self.parent = None
self.classification = None
def __repr__(self):
return f'{self.__class__.__name__} {self.id}: {self.DESC}'
def add_child(self, node):
node.set_parent(self)
self.children.append(node)
def set_parent(self, node):
self.parent = node
When I compare these two objects, it enters an infinite loop with specific data content.
To Reproduce
I have already used pickle to save the data that will cause errors as an attachment.
Node.zip
with open('N344.pickle', 'rb') as f:
n_old344, n_new344 = pickle.load(f)
with open('N437.pickle', 'rb') as f:
n_old437, n_new437 = pickle.load(f)
DeepDiff(n_old344, n_new344, ignore_order=True)
Buggy Output
RecursionError: maximum recursion depth exceeded
the infinite loop is in Node.children
Expected behavior
{'values_changed': {'root.Quantity': {'new_value': nan, 'old_value': nan},
"root.children[4].children[0].id['HP']": {'new_value': 'L48869-AE2',
'old_value': 'L48869-372'},
"root.children[4].children[0].id['IEC']": {'new_value': '6061B1252520',
'old_value': '6061B1252515'},
"root.children[4].children[0].children[0].id['HP']": {'new_value': 'L48870-AE2',
'old_value': 'L48870-372'},
"root.children[4].children[0].children[0].id['IEC']": {'new_value': 'L48870-AE2',
'old_value': 'L48870-372'}}}
OS, DeepDiff version and Python version (please complete
the following information):
- OS: Windows
- Version 10
- Python Version 3.11.3
- DeepDiff Version 6.3.0
Additional context