File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,19 @@ class InvalidPointError(RuntimeError):
8181 pass
8282
8383
84- class RValue (int ):
84+ # Plain integers in Python 2 are implemented using long in C,
85+ # which gives them at least 32 bits of precision.
86+ # Long integers have unlimited precision.
87+ # In python 3 int and long were 'unified'
88+
89+ if sys .version_info < (3 , 0 ):
90+ # flake8 is complaining on python3
91+ INT_TYPE = long # noqa: F821
92+ else :
93+ INT_TYPE = int
94+
95+
96+ class RValue (INT_TYPE ):
8597 """An r signature value that also carries the originating EC point.
8698
8799 Behaves as a regular ``int`` (equal to ``point.x() % order``) so
@@ -91,7 +103,7 @@ class RValue(int):
91103 """
92104
93105 def __new__ (cls , r , point ):
94- obj = super (RValue , cls ).__new__ (cls , r )
106+ obj = super (RValue , cls ).__new__ (cls , INT_TYPE ( r ) )
95107 obj .point = point
96108 return obj
97109
You can’t perform that action at this time.
0 commit comments