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

DM-27418: Use safe_load/dump for YAML #425

Merged
merged 6 commits into from Nov 5, 2020
Merged

DM-27418: Use safe_load/dump for YAML #425

merged 6 commits into from Nov 5, 2020

Conversation

timj
Copy link
Member

@timj timj commented Nov 4, 2020

There are also some other fixes here that came about when debugging the YAML change.

@timj timj force-pushed the tickets/DM-27418 branch 2 times, most recently from 8e9ebec to aea5c60 Compare November 4, 2020 22:17
Copy link
Member

@TallJimbo TallJimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test logic looks good to me.

tests/test_butler.py Outdated Show resolved Hide resolved
Previously if an earlier test in the loop failed by definition
all tests would fail after that because a dataset would
exist that could not be replaced.  Now each time round the
loop a new tag/collection is used so even if one fails
the next attempts (and the attempt outside the loop)
will not be affected.
It was never relocated to the _toBytes method when the
class was reorganized so in some code paths we were writing
out YAML or JSON with native python classes defined.
It was confusing to convert a YAML/JSON parse error to None
and then assume that nothing was read. This moved the
error message to a location that made no sense. Now
allow the formatter to report the parse error directly.
This ensures that people only use this default formatter
for data structures that we can trust.
This works fine for things like PropertyList where safe_load
will read it back because of the registered representers.
If an unscrupulous user enables it for something that has not
been properly setup for yaml serialization then the subsequent
safe_load will fail on read.
@timj timj merged commit f286447 into master Nov 5, 2020
@timj timj deleted the tickets/DM-27418 branch November 5, 2020 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants