Skip to content

Commit cc17f80

Browse files
committed
Add fix for time.clock removal in 3.8 for pycrypto backend
1 parent 956ed8d commit cc17f80

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

jose/backends/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
except ImportError:
55
try:
66
from jose.backends.pycrypto_backend import RSAKey # noqa: F401
7+
8+
# time.clock was deprecated in python 3.3 in favor of time.perf_counter
9+
# and removed in python 3.8. pycrypto was never updated for this. If
10+
# time has no clock attribute, let it use perf_counter instead to work
11+
# in 3.8+
12+
# noinspection PyUnresolvedReferences
13+
import time
14+
if not hasattr(time, "clock"):
15+
time.clock = time.perf_counter
16+
717
except ImportError:
818
from jose.backends.rsa_backend import RSAKey # noqa: F401
919

0 commit comments

Comments
 (0)