mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
bpo-44018: random.seed() no longer mutates its inputs (GH-25856)
This commit is contained in:
parent
2fc857a572
commit
b05352e4c2
3 changed files with 7 additions and 2 deletions
|
@ -154,8 +154,7 @@ class Random(_random.Random):
|
|||
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')
|
||||
a = int.from_bytes(a + _sha512(a).digest(), 'big')
|
||||
|
||||
elif not isinstance(a, (type(None), int, float, str, bytes, bytearray)):
|
||||
_warn('Seeding based on hashing is deprecated\n'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue