Skip to content

Commit

Permalink
Fix a bug in update_dict()
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeqfu committed Jul 6, 2022
1 parent d20ecb6 commit f7f8e65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyhelpers/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,10 @@ def update_dict(dictionary, updates, inplace=False):

for key, val in updates.items():
if isinstance(val, collections.abc.Mapping) or isinstance(val, dict):
updated_dict[key] = update_dict(dictionary.get(key, {}), val)
try:
updated_dict[key] = update_dict(dictionary.get(key, {}), val)
except TypeError:
updated_dict.update({key: val})

elif isinstance(val, list):
updated_dict[key] = (updated_dict.get(key, []) + val)
Expand Down

0 comments on commit f7f8e65

Please sign in to comment.