summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/python-pycrypto-time-clock.patch
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-05-08 21:40:51 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-05-08 21:40:51 +0200
commit4bdf4182fe080c3409f6ef9b410146b67cfa2595 (patch)
treef1123ddb8c57eda6de026982904f6c5309adaca6 /gnu/packages/patches/python-pycrypto-time-clock.patch
parentc81457a5883ea43950eb2ecdcbb58a5b144bcd11 (diff)
parent23a59b180b28b9fa22120c2b8305b9324442b94d (diff)
Merge branch 'core-updates'
Diffstat (limited to 'gnu/packages/patches/python-pycrypto-time-clock.patch')
-rw-r--r--gnu/packages/patches/python-pycrypto-time-clock.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/gnu/packages/patches/python-pycrypto-time-clock.patch b/gnu/packages/patches/python-pycrypto-time-clock.patch
new file mode 100644
index 0000000000..9b7a8232a2
--- /dev/null
+++ b/gnu/packages/patches/python-pycrypto-time-clock.patch
@@ -0,0 +1,23 @@
+Drop use of the deprecated time.clock which was removed in Python 3.8.
+
+Adapted from upstream pull request:
+
+https://github.com/dlitz/pycrypto/pull/296
+
+diff --git a/lib/Crypto/Random/_UserFriendlyRNG.py b/lib/Crypto/Random/_UserFriendlyRNG.py
+--- a/lib/Crypto/Random/_UserFriendlyRNG.py
++++ b/lib/Crypto/Random/_UserFriendlyRNG.py
+@@ -73,8 +73,11 @@ class _EntropyCollector(object):
+ t = time.time()
+ self._time_es.feed(struct.pack("@I", int(2**30 * (t - floor(t)))))
+
+- # Add the fractional part of time.clock()
+- t = time.clock()
++ # Add the fractional part of time.process_time()
++ try:
++ t = time.process_time()
++ except AttributeError:
++ t = time.clock()
+ self._clock_es.feed(struct.pack("@I", int(2**30 * (t - floor(t)))))
+
+