Skip to content

Commit

Permalink
covert str to mapper for duplicates; #39
Browse files Browse the repository at this point in the history
  • Loading branch information
rossengeorgiev committed May 22, 2021
1 parent c8c9d23 commit d2ffefa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ def parse(fp, mapper=dict, merge_duplicate_keys=True, escaped=True):
if val is None:
if merge_duplicate_keys and key in stack[-1]:
_m = stack[-1][key]
# we've descended a level deeper, if value is str, we have to overwrite it to mapper
if not isinstance(_m, mapper):
_m = stack[-1][key] = mapper()
else:
_m = mapper()
stack[-1][key] = _m
Expand Down

0 comments on commit d2ffefa

Please sign in to comment.