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 <power.jg@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Bobby R. Bruce
2020-12-11 14:09:03 -08:00
parent 9c556e7935
commit 79ed97f37b

View File

@@ -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: