Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/west/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@

import colorama
import pykwalify

try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
from yaml import SafeLoader # type: ignore

import yaml

from west.configuration import Configuration
Expand Down Expand Up @@ -649,7 +655,7 @@ def _ext_specs(project):
# Load the spec file and check the schema.
with open(spec_file) as f:
try:
commands_spec = yaml.safe_load(f.read())
commands_spec = yaml.load(f.read(), Loader=SafeLoader)
except yaml.YAMLError as e:
raise ExtensionCommandError from e
try:
Expand Down
8 changes: 7 additions & 1 deletion src/west/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@

import pykwalify.core
import yaml

try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
from yaml import SafeLoader # type: ignore

from packaging.version import parse as parse_version

from west import util
Expand Down Expand Up @@ -204,7 +210,7 @@ def _is_yml(path: PathType) -> bool:

def _load(data: str) -> Any:
try:
return yaml.safe_load(data)
return yaml.load(data, Loader=SafeLoader)
except yaml.scanner.ScannerError as e:
raise MalformedManifest(data) from e

Expand Down