From b8eaac8ec1d37b3d8e840d0310e3751a60c2a22f Mon Sep 17 00:00:00 2001 From: Roland Date: Tue, 10 Mar 2026 20:21:35 -0600 Subject: [PATCH] Using slower loader for old configs. --- wrolpi/common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wrolpi/common.py b/wrolpi/common.py index d67b08b2..a26705ff 100644 --- a/wrolpi/common.py +++ b/wrolpi/common.py @@ -537,7 +537,12 @@ class ConfigFile: def read_config_file(self, file: pathlib.Path = None) -> dict: file = file or self.get_file() with file.open('rt') as fh: - config_data = yaml.load(fh, Loader=yaml.CSafeLoader) + try: + config_data = yaml.load(fh, Loader=yaml.CSafeLoader) + except yaml.constructor.ConstructorError: + logger_.warning(f'Config file contains Python objects, using slow loader: {file}') + fh.seek(0) + config_data = yaml.load(fh, Loader=yaml.Loader) if not isinstance(config_data, dict): raise InvalidConfig(f'Config file is invalid: {file}') return config_data