support/testing/../sample_python_pyyaml_dec.py: unbreak after move to pyaml 6.0
PATCH 1/1 support/testing/../sample_python_pyyaml_dec.py: unbreak after move to pyaml 6.0
Fixes https://gitlab.com/buildroot.org/buildroot/-/jobs/2088684091
python sample_python_pyyaml_dec.py
Traceback (most recent call last):
File "/root/sample_python_pyyaml_dec.py", line 5, in <module>
data = yaml.load(serialized)
TypeError: load() missing 1 required positional argument: 'Loader'
yaml.load() requires a loader argument since the move to version 6.0:
https://github.com/yaml/pyyaml/pull/561
The test does not need the extra functionality of load(), so instead move to the recommended safe_load().
--- support/testing/tests/package/sample_python_pyyaml_dec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
support/testing/tests/package/sample_python_pyyaml_dec.py +1 -1
@@ -2,7 +2,7 @@ import yaml with open("/tmp/data.yml", "rb") as f: serialized = f.read() -data = yaml.load(serialized) +data = yaml.safe_load(serialized) print(data) assert(data["name"] == "python-pyyaml") assert(data["versions"] == ["1", "2"])
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Peter,
Le 20/02/2022 à 22:10, Peter Korsgaard a écrit :
Quoted 8 lines
Fixes https://gitlab.com/buildroot.org/buildroot/-/jobs/2088684091
python
sample_python_pyyaml_dec.py
Traceback (most recent call last):
File "/root/sample_python_pyyaml_dec.py", line 5, in <module>
data =yaml.load(serialized)
TypeError:load()missing 1 required positional argument: 'Loader'
Quoted 7 lines
yaml.load()requires a loader argument since the move to version 6.0:
https://github.com/yaml/pyyaml/pull/561The test does not need the extra functionality of
load(), so instead move to the recommendedsafe_load().Signed-off-by Peter Korsgaard <[email protected]>
I did the same change while investigating this issue before replying to:
http://lists.busybox.net/pipermail/buildroot/2022-February/637414.html
Best regards,
Romain
Quoted 9 lines
--- support/testing/tests/package/sample_python_pyyaml_dec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)support/testing/tests/package/sample_python_pyyaml_dec.py +0
-0
support/testing/tests/package/sample_python_pyyaml_dec.py import yaml · line 8
Quoted 8 lines
support/testing/tests/package/sample_python_pyyaml_dec.py +1
-1@@ -2,7 +2,7 @@ import yaml with open("/tmp/data.yml", "rb") as f: serialized = f.read() -data = yaml.load(serialized) +data = yaml.safe_load(serialized) print(data) assert(data["name"] == "python-pyyaml") assert(data["versions"] == ["1", "2"])
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Korsgaard <[email protected]> writes:
Fixes https://gitlab.com/buildroot.org/buildroot/-/jobs/2088684091
pythonsample_python_pyyaml_dec.py
Traceback (most recent call last):
File "/root/sample_python_pyyaml_dec.py", line 5, in <module>
data =yaml.load(serialized)
TypeError:load()missing 1 required positional argument: 'Loader'
Quoted 7 lines
yaml.load()requires a loader argument since the move to version 6.0:
https://github.com/yaml/pyyaml/pull/561The test does not need the extra functionality of
load(), so instead move to the recommendedsafe_load().Signed-off-by Peter Korsgaard <[email protected]>
Committed, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot