Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyyaml should disable duplicate keys #701

Closed
zsfbct opened this issue Feb 21, 2023 · 1 comment
Closed

pyyaml should disable duplicate keys #701

zsfbct opened this issue Feb 21, 2023 · 1 comment
Labels

Comments

@zsfbct
Copy link

zsfbct commented Feb 21, 2023

The YAML spec disables duplicate keys. When there exist duplicate keys, pyyaml doesn't catch it as an error but simply override.

For reference: https://stackoverflow.com/questions/53920358/pyyaml-loading-yaml-1-1-with-duplicate-keys

It should check keys uniqueness with similar logic to the code below in constructor.py

        if key in mapping:
             warnings.warn(somewarning)
        else:
            mapping[key] = value
@perlpunk
Copy link
Member

duplicate of #165
Especially see my comment #165 (comment)
So fixing it is not that trivial, but PRs that keep existing merge key behaviour are welcome.

@perlpunk perlpunk closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants