changeset 686:80d203ed3556

FIX: The YAML loader had wrong format strings in its exception handlers. This is a code-path that is executed extremely rarely.
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 10 Jun 2023 21:58:16 +0200
parents 2e7920b0b4d9
children 7b3c3a89f720
files configmix/yaml.py
diffstat 1 files changed, 8 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/configmix/yaml.py	Sat Jun 10 21:38:13 2023 +0200
+++ b/configmix/yaml.py	Sat Jun 10 21:58:16 2023 +0200
@@ -79,16 +79,14 @@
             except TypeError as err:
                 raise yaml.constructor.ConstructorError(
                     'while constructing a mapping', node.start_mark,
-                    'found unacceptable key (%s)' % (err,
-                                                     key_node.start_mark)
-                )
+                    'found unacceptable key (%s)' % (err, ),
+                    key_node.start_mark)
             value = self.construct_object(value_node, deep=deep)
             if not self.__allow_duplicate_keys and key in mapping:
                 raise yaml.constructor.ConstructorError(
                     'while constructing a mapping', node.start_mark,
-                    'found duplicate key %r (%s)' % (key,
-                                                     key_node.start_mark)
-                )
+                    'found duplicate key %r' % (key, ),
+                    key_node.start_mark)
             mapping[key] = value
         return mapping
 
@@ -144,7 +142,6 @@
                 None,
                 'expected a mapping node, but found %s' % node.id,
                 node.start_mark)
-
         mapping = DictImpl()
         for key_node, value_node in node.value:
             key = self.construct_object(key_node, deep=deep)
@@ -153,16 +150,14 @@
             except TypeError as err:
                 raise yaml.constructor.ConstructorError(
                     'while constructing a mapping', node.start_mark,
-                    'found unacceptable key (%s)' % (err,
-                                                     key_node.start_mark)
-                )
+                    'found unacceptable key (%s)' % (err, ),
+                    key_node.start_mark)
             value = self.construct_object(value_node, deep=deep)
             if not self.__allow_duplicate_keys and key in mapping:
                 raise yaml.constructor.ConstructorError(
                     'while constructing a mapping', node.start_mark,
-                    'found duplicate key %r (%s)' % (key,
-                                                     key_node.start_mark)
-                )
+                    'found duplicate key %r' % (key, ),
+                    key_node.start_mark)
             mapping[key] = value
         return mapping