Skip to content

Use yaml.safe_load() instead of load()#921

Merged
nsoranzo merged 1 commit intogalaxyproject:masterfrom
nsoranzo:safe_load
Apr 16, 2019
Merged

Use yaml.safe_load() instead of load()#921
nsoranzo merged 1 commit intogalaxyproject:masterfrom
nsoranzo:safe_load

Conversation

@nsoranzo
Copy link
Member

Fix warnings like:

planemo/shed/__init__.py:436: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  config = yaml.load(f)

Fix warnings like:

```
planemo/shed/__init__.py:436: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  config = yaml.load(f)
```
@martenson
Copy link
Member

This is pure refactoring, right? afair safe() is just a wrapper around safe_load() now.

@nsoranzo
Copy link
Member Author

You mean load() is just a wrapper?

And no, if you read at link in the message above it clearly states:

Since load cannot break backward compatibility to call safe_load, the maintainers of PyYAML decided to simply deprecate the plain usage of load, and require that the user intentionally declare the Loader they desired.

and

FullLoader: Loads the full YAML language. Avoids arbitrary code execution. This is currently (PyYAML 5.1) the default loader called by yaml.load(input) (after issuing the warning).

while safe_load() use the SafeLoader.

@martenson
Copy link
Member

My memory failed me then. 👀

@nsoranzo nsoranzo merged commit d20a1e4 into galaxyproject:master Apr 16, 2019
@nsoranzo nsoranzo deleted the safe_load branch April 16, 2019 23:07
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.

2 participants