diff options
author | Anthon van der Neut <anthon@mnt.org> | 2017-06-09 07:07:18 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2017-06-09 07:07:18 +0200 |
commit | cb15ef0ad512c00584ff4195ca88334d1f2b0fa6 (patch) | |
tree | 71839804b30b9c92c4a2d8243529c4704de5cf30 /constructor.py | |
parent | 4b847b7d4706726c3a32f158fd480e61b6c3019f (diff) | |
download | ruamel.yaml-cb15ef0ad512c00584ff4195ca88334d1f2b0fa6.tar.gz |
rt set handling now checks for duplicate keys
Diffstat (limited to 'constructor.py')
-rw-r--r-- | constructor.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/constructor.py b/constructor.py index 83cbbec..a37f794 100644 --- a/constructor.py +++ b/constructor.py @@ -246,7 +246,7 @@ class BaseConstructor(object): "while constructing a mapping", node.start_mark, 'found duplicate key "{}" with value "{}" ' '(original value: "{}")'.format( - key, value, mapping[key]), key_node.start_mark, + key, value, mapping.get(key)), key_node.start_mark, """ To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys @@ -1243,7 +1243,9 @@ class RoundTripConstructor(SafeConstructor): raise ConstructorError( "while constructing a mapping", node.start_mark, "found unhashable key", key_node.start_mark) + # construct but should be null value = self.construct_object(value_node, deep=deep) # NOQA + self.check_mapping_key(node, key_node, typ, key, value) if key_node.comment: typ._yaml_add_comment(key_node.comment, key=key) if value_node.comment: |