Skip to content

Commit 083e07e

Browse files
committed
fix the int/long type in python2.7
1 parent 76833c8 commit 083e07e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/ecdsa/ecdsa.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,13 @@ class RSZeroError(RuntimeError):
8080
class InvalidPointError(RuntimeError):
8181
pass
8282

83+
if sys.version_info < (3, 0):
84+
INT_TYPE = long
85+
else:
86+
INT_TYPE = int
8387

84-
class RValue(int):
88+
89+
class RValue(INT_TYPE):
8590
"""An r signature value that also carries the originating EC point.
8691
8792
Behaves as a regular ``int`` (equal to ``point.x() % order``) so
@@ -91,7 +96,7 @@ class RValue(int):
9196
"""
9297

9398
def __new__(cls, r, point):
94-
obj = super(RValue, cls).__new__(cls, r)
99+
obj = super(RValue, cls).__new__(cls, INT_TYPE(r))
95100
obj.point = point
96101
return obj
97102

0 commit comments

Comments
 (0)