Skip to content

Commit

Permalink
use hasattr instead of getattr None
Browse files Browse the repository at this point in the history
  • Loading branch information
artemisart committed Sep 3, 2024
1 parent cc30a3c commit c1161b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deepdiff/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def unmangle(attribute):
else:
all_slots.extend(slots)

return {i: getattr(object, unmangle(i), None) for i in all_slots}
return {i: getattr(object, key) for i in all_slots if hasattr(object, key := unmangle(i))}

def _diff_enum(self, level, parents_ids=frozenset(), local_tree=None):
t1 = detailed__dict__(level.t1, include_keys=ENUM_INCLUDE_KEYS)
Expand Down

0 comments on commit c1161b3

Please sign in to comment.