Skip to content

Commit fc12e89

Browse files
author
Michael Davis
authored
Merge pull request #24 from mpdavis/remove-builtins-import
Remove builtins import to support GAE
2 parents 080fc36 + 3dcc942 commit fc12e89

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

jose/jwk.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
import hmac
55
import struct
66
import six
7-
8-
from builtins import int
7+
import sys
98

109
import Crypto.Hash.SHA256
1110
import Crypto.Hash.SHA384
@@ -28,6 +27,11 @@
2827
else:
2928
_RSAKey = RSA.RsaKey
3029

30+
# Deal with integer compatibilities between Python 2 and 3.
31+
# Using `from builtins import int` is not supported on AppEngine.
32+
if sys.version_info > (3,):
33+
long = int
34+
3135

3236
def get_algorithm_object(algorithm):
3337
"""
@@ -65,7 +69,7 @@ def get_algorithm_object(algorithm):
6569

6670

6771
def int_arr_to_long(arr):
68-
return int(''.join(["%02x" % byte for byte in arr]), 16)
72+
return long(''.join(["%02x" % byte for byte in arr]), 16)
6973

7074

7175
def base64_to_long(data):

0 commit comments

Comments
 (0)