yacs icon indicating copy to clipboard operation
yacs copied to clipboard

Duplicate keys in YAML are overwritten with the last key

Open bernhardschaefer opened this issue 5 years ago • 1 comments

yacs uses safe_load() from pyyaml.

There is a downstream bug with duplicate keys, in the current implementation pyyaml only considers the last key occurrence and does not produce any warning/error: https://github.com/yaml/pyyaml/issues/165 The linked issue contains discussions about workarounds.

This leads to very subtle errors, see e.g. https://github.com/facebookresearch/maskrcnn-benchmark/pull/545

bernhardschaefer avatar Mar 08 '19 09:03 bernhardschaefer

Thanks for flagging this issue. I agree that yacs should check for duplicate keys and raise an exception if any are found.

rbgirshick avatar Mar 09 '19 14:03 rbgirshick