File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ def remove_boolean(string):
285285 # the workaround due to instrumental, that
286286 # saves the binary data as UTF-8 string
287287 # (0xff is an invalid start byte)
288- if isinstance (body , text_type ):
288+ if isinstance (body , text_type ): # pragma: no branch
289289 body = body .encode ("utf-8" )
290290 num = int (binascii .hexlify (body ), 16 )
291291 if num == 0xFF :
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 ): # pragma:no branch
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