Skip to contentSkip to conversation

support/testing/../sample_python_pyyaml_dec.py: unbreak after move to pyaml 6.0

PATCH In review Peter Korsgaard 2 participants 3 messages Feb 20, 2022 – Feb 21, 2022

lore
Share & tools
lore
#0 lore raw

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
index 9ab8931197..bb90934f26 100644
@@ -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
Tested-by on v1 1/1
#1 lore raw

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/561

The test does not need the extra functionality of load(), so instead move to the recommended safe_load().

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
index 9ab8931197..bb90934f26 100644

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

#2 lore raw
In reply to Peter Korsgaard
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
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/561

The test does not need the extra functionality of load(), so instead move to the recommended safe_load().

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot