File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- from collections .abc import MutableMapping
1+ from collections .abc import MutableMapping , Sized
22from collections .abc import MutableSequence
33from dpath import options
44from dpath .exceptions import InvalidKeyName
@@ -286,13 +286,13 @@ def are_both_mutable(o1, o2):
286286 return False
287287
288288 def merger (dst , src , _segments = ()):
289- if not isinstance (dst , dict ) or not isinstance (src , dict ):
290- raise ValueError ("Merger function supports dict-like objects only" )
291-
292289 for key , found in dpath .segments .kvs (src ):
293290 # Our current path in the source.
294291 segments = _segments + (key ,)
295292
293+ if not isinstance (key , Sized ):
294+ raise ValueError ("Merger function supports dict-like objects only" )
295+
296296 if len (key ) == 0 and not options .ALLOW_EMPTY_STRING_KEYS :
297297 raise InvalidKeyName ("Empty string keys not allowed without "
298298 "dpath.options.ALLOW_EMPTY_STRING_KEYS=True: "
You can’t perform that action at this time.
0 commit comments