From 79ed97f37b69506071dd4d4397f0e1c7a1ad52e2 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Fri, 11 Dec 2020 14:09:03 -0800 Subject: [PATCH] util,python: Updated maintainers.py to fix deprecation warning The following warning was being thrown: ``` util/maint/lib/maintainers.py:120: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. ``` This is fixed by adding `Loader=yaml.SafeLoader` when calling `yaml.load()`. Change-Id: I3b79115379a45409967a8848175658ab3c13bfc7 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38476 Reviewed-by: Jason Lowe-Power Reviewed-by: Andreas Sandberg Maintainer: Jason Lowe-Power Tested-by: kokoro --- util/maint/lib/maintainers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/maint/lib/maintainers.py b/util/maint/lib/maintainers.py index 0b29b67be..6dd8d268e 100644 --- a/util/maint/lib/maintainers.py +++ b/util/maint/lib/maintainers.py @@ -106,7 +106,7 @@ class Maintainers(object): @classmethod def from_yaml(cls, yaml_str: str) -> "Maintainers": - return cls(yaml.load(yaml_str)) + return cls(yaml.load(yaml_str, Loader=yaml.SafeLoader)) @classmethod def _load_maintainers_file(cls, @@ -117,9 +117,9 @@ class Maintainers(object): if isinstance(path_or_file, str): with open(path_or_file, 'r') as fin: - return yaml.load(fin) + return yaml.load(fin, Loader=yaml.SafeLoader) else: - return yaml.load(path_or_file) + return yaml.load(path_or_file, Loader=yaml.SafeLoader) @classmethod def _parse_subsystem(cls, tag: str, ydict: Mapping[str, Any]) -> Subsystem: -- 2.30.2