summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-08-17 08:10:33 +0200
committerAnthon van der Neut <anthon@mnt.org>2018-08-17 08:10:33 +0200
commit310a4f9738ce6212dc684479784c15a50fbc0f5f (patch)
treeb3a9cb33de3fda82d5e5ad6fd3e388a0fc42d956
parent81fdb659f35a533c29fc163ac679d0c6068385d9 (diff)
downloadruamel.yaml-310a4f9738ce6212dc684479784c15a50fbc0f5f.tar.gz
fix for 2.7, ruamel.ordereddict expects ordered input
-rw-r--r--comments.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/comments.py b/comments.py
index 6713829..83e0254 100644
--- a/comments.py
+++ b/comments.py
@@ -992,7 +992,13 @@ class CommentedKeyMap(CommentedBase, Mapping):
# type: (Any, Any) -> None
if hasattr(self, '_od'):
raise_immutable(self)
- self._od = ordereddict(*args, **kw)
+ try:
+ self._od = ordereddict(*args, **kw)
+ except TypeError:
+ if PY2:
+ self._od = ordereddict(args[0].items())
+ else:
+ raise
__delitem__ = __setitem__ = clear = pop = popitem = setdefault = update = raise_immutable