From 9015aab8ea3d875dfecad0799cdd9fe2989ca0e3 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 24 Jul 2013 14:37:09 +0200 Subject: [PATCH] In Python 3 OrderedDict.keys() are not indexable We could always cast counts.keys() to a list, from the dictionary view they are but a more efficient way of doing this is to simply pop the items from our result list as we traverse the returned iterable dictionary view. --- gnupg/_parsers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnupg/_parsers.py b/gnupg/_parsers.py index 6a9e4ec..df0187d 100644 --- a/gnupg/_parsers.py +++ b/gnupg/_parsers.py @@ -1056,8 +1056,8 @@ class ImportResult(object): 'status': self._problem_reason[reason]}) elif key == "IMPORT_RES": import_res = value.split() - for x in range(len(self.counts)): - self.counts[self.counts.keys()[x]] = int(import_res[x]) + for x in self.counts.keys(): + self.counts[x] = int(import_res.pop(0)) elif key == "KEYEXPIRED": res = {'fingerprint': None, 'status': 'Key expired'}