From f8751ca94b927e7e66ba2c90e5d2cd00b2bdb347 Mon Sep 17 00:00:00 2001 From: Andreas Gebhardt Date: Sun, 30 Jun 2019 20:03:49 +0200 Subject: [PATCH] =?UTF-8?q?fix=20PyYAML=20warning=20on=20call=20of=20`yaml?= =?UTF-8?q?.load(=E2=80=A6)`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since PyYAML v5.1 a warning on deprecation is printed: > YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, > as the default Loader is unsafe. Please read https://msg.pyyaml.org/load > for full details. Use the `FullLoader`s suggared variant `yaml.full_load` according to the documentation [1] if it's present. Then it's assumed that PyYAML >= v5.1 is used. [1] https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation#how-to-disable-the-warning --- hbmqtt/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbmqtt/utils.py b/hbmqtt/utils.py index 8eca44a..0153db4 100644 --- a/hbmqtt/utils.py +++ b/hbmqtt/utils.py @@ -48,7 +48,7 @@ def read_yaml_config(config_file): config = None try: with open(config_file, 'r') as stream: - config = yaml.load(stream) + config = yaml.full_load(stream) if hasattr(yaml, 'full_load') else yaml.load(stream) except yaml.YAMLError as exc: logger.error("Invalid config_file %s: %s" % (config_file, exc)) return config