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

Load YAML as binary data #2566

Merged
merged 2 commits into from
May 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions beets/util/confit.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def load_yaml(filename):
parsed, a ConfigReadError is raised.
"""
try:
with open(filename, 'r') as f:
with open(filename, 'rb') as f:
return yaml.load(f, Loader=Loader)
except (IOError, yaml.error.YAMLError) as exc:
raise ConfigReadError(filename, exc)
Expand Down Expand Up @@ -908,9 +908,10 @@ def dump(self, full=True, redact=False):
default_source = source
break
if default_source and default_source.filename:
with open(default_source.filename, 'r') as fp:
with open(default_source.filename, 'rb') as fp:
default_data = fp.read()
yaml_out = restore_yaml_comments(yaml_out, default_data)
yaml_out = restore_yaml_comments(yaml_out,
default_data.decode('utf8'))

return yaml_out

Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ Fixes:
* :doc:`/plugins/web`: Avoid a crash when sending binary data, such as
Chromaprint fingerprints, in music attributes. :bug:`2542` :bug:`2532`
* Fix a hang when parsing templates that end in newlines. :bug:`2562`
* Fix a crash when reading non-ASCII characters in configuration files on
Windows under Python 3. :bug:`2456` :bug:`2565` :bug:`2566`

Two plugins had backends removed due to bitrot:

Expand Down