Browse Source

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().

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Tested-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Peter Korsgaard 3 years ago
parent
commit
a83177aac6
1 changed files with 1 additions and 1 deletions
  1. 1 1
      support/testing/tests/package/sample_python_pyyaml_dec.py

+ 1 - 1
support/testing/tests/package/sample_python_pyyaml_dec.py

@@ -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"])