mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Minor beautification (turn nested-if into a conjunction).
This commit is contained in:
parent
5f30f79357
commit
2f9cc7ab0c
1 changed files with 5 additions and 6 deletions
|
@ -119,12 +119,11 @@ class Random(_random.Random):
|
||||||
x ^= len(a)
|
x ^= len(a)
|
||||||
a = -2 if x == -1 else x
|
a = -2 if x == -1 else x
|
||||||
|
|
||||||
if version == 2:
|
if version == 2 and isinstance(a, (str, bytes, bytearray)):
|
||||||
if isinstance(a, (str, bytes, bytearray)):
|
if isinstance(a, str):
|
||||||
if isinstance(a, str):
|
a = a.encode()
|
||||||
a = a.encode()
|
a += _sha512(a).digest()
|
||||||
a += _sha512(a).digest()
|
a = int.from_bytes(a, 'big')
|
||||||
a = int.from_bytes(a, 'big')
|
|
||||||
|
|
||||||
super().seed(a)
|
super().seed(a)
|
||||||
self.gauss_next = None
|
self.gauss_next = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue