Skip to content

Commit 60d96c4

Browse files
committed
Fix passing a generator to OrderedDict()
1 parent dd92e90 commit 60d96c4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Lib/_collections_abc.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,11 @@ def update(*args, **kwds):
836836
len(args))
837837
if args:
838838
other = args[0]
839-
if isinstance(other, Mapping):
839+
try:
840+
mapping_inst = isinstance(other, Mapping)
841+
except TypeError:
842+
mapping_inst = False
843+
if mapping_inst:
840844
for key in other:
841845
self[key] = other[key]
842846
elif hasattr(other, "keys"):

0 commit comments

Comments
 (0)