1 |
commit: 1cb701ee64e06badb16a0086bb4e46184633c5da |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 29 00:27:46 2015 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Oct 29 00:27:46 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=1cb701ee |
7 |
|
8 |
config: tweak walking of settings for py3 |
9 |
|
10 |
Since py3 returns an iterator with dict.keys(), trying to add/del values |
11 |
in the loop will throw an exception. Run it through list() so we get a |
12 |
static copy to iterate over. |
13 |
|
14 |
catalyst/config.py | 3 ++- |
15 |
1 file changed, 2 insertions(+), 1 deletion(-) |
16 |
|
17 |
diff --git a/catalyst/config.py b/catalyst/config.py |
18 |
index db81a96..5f72e15 100644 |
19 |
--- a/catalyst/config.py |
20 |
+++ b/catalyst/config.py |
21 |
@@ -97,7 +97,8 @@ class ParserBase(object): |
22 |
values[cur_array[0]] = cur_array[1:] |
23 |
|
24 |
if not self.empty_values: |
25 |
- for x in values.keys(): |
26 |
+ # Make sure the list of keys is static since we modify inside the loop. |
27 |
+ for x in list(values.keys()): |
28 |
# Delete empty key pairs |
29 |
if not values[x]: |
30 |
log.warning('No value set for key "%s"; deleting', x) |