sos/backport-Fix-dict-order-py38-incompatibility.patch

35 lines
1.3 KiB
Diff

From 1d7bab6c7ce3f78758113ca3cdf3e9fa1762df24 Mon Sep 17 00:00:00 2001
From: Eric Desrochers <eric.desrochers@canonical.com>
Date: Wed, 19 Aug 2020 17:44:07 -0400
Subject: [PATCH] [options] Fix dict order py38 incompatibility
python-3.8 dict changes introduce a traceback during our config file
parsing for options with `-` characters in them.
Fix this by changing an iteration of the dict keys from `dict.keys()`
that returns a dict_keys view, to `list(dict)` which returns a list copy
of the keys.
Closes: #2206
Resolves: #2207
Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
sos/options.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sos/options.py b/sos/options.py
index 3a2b4292f..ba3db1303 100644
--- a/sos/options.py
+++ b/sos/options.py
@@ -186,7 +186,7 @@ def _update_from_section(section, config):
if 'verbose' in odict.keys():
odict['verbosity'] = int(odict.pop('verbose'))
# convert options names
- for key in odict.keys():
+ for key in list(odict):
if '-' in key:
odict[key.replace('-', '_')] = odict.pop(key)
# set the values according to the config file