Duplicate keys are not handled properly
See original GitHub issueYAML spec in version 1.2 says that in a valid YAML file, mapping keys are unique.
This is not the case in pyyaml, as can be seen by loading this sample file:
a:
- b
- c
a:
q: a
q: b
The correct result from loading this file is an error. pyyaml instead naively overwrites results with the last key, resulting in this dict: {'a': {'q': 'b'}}
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:36
- Comments:20 (7 by maintainers)
Top Results From Across the Web
Will A Locksmith Copy A “Do Not Duplicate” Key?
Yet the fact remains that keys stamped with “Do Not Duplicate” are no more secure than keys without it. According to the Associated...
Read more >All About "Do Not Duplicate" Keys - Door Locks Direct
Learn all about “do not duplicate” keys and what you should do if you've lost your keys at Door Locks Direct. Call us...
Read more >Proper layer to handle duplicate keys
My understanding to handle duplicate keys should be handled by the database. For example, When a user wants to add new entity with...
Read more >Do Not Duplicate Keys Debunked - Industrial Lock and Security
If you're a business owner, having these signs engraved on your keys won't guarantee lock security. The best way to secure your company...
Read more >Implementing Binary Search Tree To Handle Duplicate Keys ...
One important problem with our implementation of insert is that duplicate keys are not handled properly. As our tree is implemented a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
PyYAML should reject duplicate keys per the YAML spec. These are silent errors in users’ code. Do what
ruamel.yaml
does, and add ayaml.allow_duplicate_keys = True
property for those who want to opt-in.The YAML 1.1 spec also says that keys should be unique: https://yaml.org/spec/1.1/#id861060