scripts: dts: gen_driver_kconfig_dts: Use SafeLoader
Using SafeLoader is preferrable where possible. Signed-off-by: Moritz Fischer <moritzf@google.com>
This commit is contained in:
parent
dd468fc261
commit
7dd05967f7
1 changed files with 3 additions and 3 deletions
|
@ -12,9 +12,9 @@ import re
|
||||||
import yaml
|
import yaml
|
||||||
try:
|
try:
|
||||||
# Use the C LibYAML parser if available, rather than the Python parser.
|
# Use the C LibYAML parser if available, rather than the Python parser.
|
||||||
from yaml import CLoader as Loader
|
from yaml import CSafeLoader as SafeLoader
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from yaml import Loader # type: ignore
|
from yaml import SafeLoader # type: ignore
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'python-devicetree',
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'python-devicetree',
|
||||||
'src'))
|
'src'))
|
||||||
|
@ -75,7 +75,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
# Parsed PyYAML output (Python lists/dictionaries/strings/etc.,
|
# Parsed PyYAML output (Python lists/dictionaries/strings/etc.,
|
||||||
# representing the file)
|
# representing the file)
|
||||||
raw = yaml.load(contents, Loader=Loader)
|
raw = yaml.load(contents, Loader=SafeLoader)
|
||||||
except yaml.YAMLError as e:
|
except yaml.YAMLError as e:
|
||||||
print(f"WARNING: '{binding_path}' appears in binding "
|
print(f"WARNING: '{binding_path}' appears in binding "
|
||||||
f"directories but isn't valid YAML: {e}")
|
f"directories but isn't valid YAML: {e}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue