commit:     1cb701ee64e06badb16a0086bb4e46184633c5da
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 29 00:27:46 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Oct 29 00:27:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=1cb701ee

config: tweak walking of settings for py3

Since py3 returns an iterator with dict.keys(), trying to add/del values
in the loop will throw an exception.  Run it through list() so we get a
static copy to iterate over.

 catalyst/config.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/catalyst/config.py b/catalyst/config.py
index db81a96..5f72e15 100644
--- a/catalyst/config.py
+++ b/catalyst/config.py
@@ -97,7 +97,8 @@ class ParserBase(object):
                                values[cur_array[0]] = cur_array[1:]
 
                if not self.empty_values:
-                       for x in values.keys():
+                       # Make sure the list of keys is static since we modify 
inside the loop.
+                       for x in list(values.keys()):
                                # Delete empty key pairs
                                if not values[x]:
                                        log.warning('No value set for key "%s"; 
deleting', x)

Reply via email to