Open aviasd opened 3 years ago
I ran into this issue as well, had to revert back to 5.4.1 to get our tests working again.
support/frames_parser.py:14: in __init__
file = yaml.load(open(file_path))
E TypeError: load() missing 1 required positional argument: 'Loader'
We got hit by the same error which is related to https://github.com/yaml/pyyaml/pull/561 which was included yesterday in the latest major release of PyYAML 6.0.
The simple yaml.load(f)
call has been deprecated in the 5.x line in favor of yaml.load(f, Loader=loader)
. Either capping PyYAML to 5.x or updating all usages of yaml.load
should restore your builds.
TBC: this is as-designed. Loading without specifying a loader has been deprecated and issuing loud warnings for the past three years (since 5.1), due to numerous CVEs being filed against the default loader's ability to execute arbitrary(ish) code. Since changing the default to a significantly less-capable loader was just as big a breaking change (and one that could cause more problems in the future), it was decided to just require folks to be specific about the capability they required from the loader going forward.
Reopening this for a spell until the dust settles.
Retitled the issue and pinned it.
The documentation still presents the old usage of load
, which is now invalid, in quite a few places. I opened an issue on the documentation's repository.
@cirodrig I did not find your documentation issue, can you post a link?
I think the documentation should point out what the recommended loader is now that users need to specify it. I guess there is no single recommended loader, so the recommendation should cover which loader is recommended for which use case. I don't find that in the documentation today.
@andy-maier I created an issue here https://github.com/yaml/pyyaml.org/issues/15
I find it disappoint, however, that the documentation tutorial examples do not work https://pyyaml.org/wiki/PyYAMLDocumentation
import yaml
>>> yaml.load("""
... - Hesperiidae
... - Papilionidae
... - Apatelodidae
... - Epiplemidae
... """)
Yeah, that is not a good solution at all. Breaking 100% of old code is worse than breaking 0.5% of old code that is depending on some of the insecure functionality of the old default loader. Just default to a secure loader as the new default. It is a breaking change, but nowhere near as breaking as this.
The worst is when I have several different packages in my downstream dependencies using PyYAML and some use the new functionality and declare the PyYAML 6 as dependency while others do not provide a loader object to load and just crash now.
Change the PyYAML tutorial for the new syntax at least and let that be up for three years, maybe then it would be ok as a change. But a less destruictive change is always better than more destructive one.
TBC: this is as-designed. Loading without specifying a loader has been deprecated and issuing loud warnings for the past three years (since 5.1), due to numerous CVEs being filed against the default loader's ability to execute arbitrary(ish) code. Since changing the default to a significantly less-capable loader was just as big a breaking change (and one that could cause more problems in the future), it was decided to just require folks to be specific about the capability they required from the loader going forward.
I don't think it's a good design. It's not in line with the usage habits.
Is there a reason why the documentation /still isn't updated a year later/?
When using an updated version of
pyyaml
(version 6.0) on Google Colab, there is an import problem in some of Google Colab python packages, likeplotly.express
:When reverting back to
pyyaml
version 5.4.1, the problem is solved.