diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-08-17 08:10:33 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-08-17 08:10:33 +0200 |
commit | 310a4f9738ce6212dc684479784c15a50fbc0f5f (patch) | |
tree | b3a9cb33de3fda82d5e5ad6fd3e388a0fc42d956 /comments.py | |
parent | 81fdb659f35a533c29fc163ac679d0c6068385d9 (diff) | |
download | ruamel.yaml-310a4f9738ce6212dc684479784c15a50fbc0f5f.tar.gz |
fix for 2.7, ruamel.ordereddict expects ordered input
Diffstat (limited to 'comments.py')
-rw-r--r-- | comments.py | 8 |
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 |