diff options
author | Michael Manganiello <adamantike@users.noreply.github.com> | 2017-01-17 13:33:08 -0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2017-01-17 17:33:08 +0100 |
commit | 2d81e0fe4b89398876da8a9027d1465a5bb4434b (patch) | |
tree | d37949454e2a741e21de3993113b5f08c30e12f1 | |
parent | d3727172cedb409613739be6af197c3b03cc163d (diff) | |
download | rsa-git-2d81e0fe4b89398876da8a9027d1465a5bb4434b.tar.gz |
Use iterative zip in Python 2 (#85)
Good catch, thanks!
-rw-r--r-- | rsa/_compat.py | 3 | ||||
-rw-r--r-- | rsa/common.py | 2 | ||||
-rw-r--r-- | rsa/key.py | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/rsa/_compat.py b/rsa/_compat.py index 38bab08..71197a5 100644 --- a/rsa/_compat.py +++ b/rsa/_compat.py @@ -18,6 +18,7 @@ from __future__ import absolute_import +import itertools import sys from struct import pack @@ -42,9 +43,11 @@ else: if PY2: integer_types = (int, long) range = xrange + zip = itertools.izip else: integer_types = (int, ) range = range + zip = zip def write_to_stdout(data): diff --git a/rsa/common.py b/rsa/common.py index 4f8c0d9..7c8a082 100644 --- a/rsa/common.py +++ b/rsa/common.py @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from rsa._compat import zip + """Common functionality shared by several modules.""" @@ -491,7 +491,7 @@ class PrivateKey(AbstractKey): if priv[0] != 0: raise ValueError('Unable to read this file, version %s != 0' % priv[0]) - as_ints = tuple(map(int, priv[1:6])) + as_ints = map(int, priv[1:6]) key = cls(*as_ints) exp1, exp2, coef = map(int, priv[6:9]) |