Skip to content

Commit a0ac96d

Browse files
authored
Fix ignore_keys issue in detailed__dict__
If `key` is not in result, then there's no point in trying to delete it anyway
1 parent 60ac5b9 commit a0ac96d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

deepdiff/helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,8 @@ def detailed__dict__(obj: Any, ignore_private_variables: bool = True, ignore_key
739739
else:
740740
result = obj.__dict__.copy() # A shallow copy
741741
private_var_prefix = f"_{obj.__class__.__name__}__" # The semi private variables in Python get this prefix
742-
for key in ignore_keys:
743-
if key in result or (
742+
for key in obj.__dict__:
743+
if key in ignore_keys or (
744744
ignore_private_variables and key.startswith('__') and not key.startswith(private_var_prefix)
745745
):
746746
del result[key]

0 commit comments

Comments
 (0)