Message320383
I'm thinking of something like this:
$ git diff
diff --git a/Lib/random.py b/Lib/random.py
index 1e0dcc87ed..f479e66ada 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -136,12 +136,17 @@ class Random(_random.Random):
x ^= len(a)
a = -2 if x == -1 else x
- if version == 2 and isinstance(a, (str, bytes, bytearray)):
+ elif version == 2 and isinstance(a, (str, bytes, bytearray)):
if isinstance(a, str):
a = a.encode()
a += _sha512(a).digest()
a = int.from_bytes(a, 'big')
+ elif not isinstance(a, (type(None), int, float, str, bytes, bytearray)):
+ _warn('Seeding based on hashing is deprecated.\n'
+ 'The only supported seed types are None, int, float, '
+ 'str, bytes, and bytearray.', DeprecationWarning, 2)
+
super().seed(a)
self.gauss_next = None |
|
Date |
User |
Action |
Args |
2018-06-24 19:44:55 | rhettinger | set | recipients:
+ rhettinger, mark.dickinson, vstinner, docs@python, serhiy.storchaka, johnnyd |
2018-06-24 19:44:55 | rhettinger | set | messageid: <1529869495.86.0.56676864532.issue32554@psf.upfronthosting.co.za> |
2018-06-24 19:44:55 | rhettinger | link | issue32554 messages |
2018-06-24 19:44:55 | rhettinger | create | |
|