diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-09-06 16:33:52 -0700 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-09-06 16:33:52 -0700 |
commit | e66987e626cfce8292c39d5b1394665e8aa6840b (patch) | |
tree | ec94354a9ccb2f09e77e3a2381b52142544d0ee2 /Lib/random.py | |
parent | e256accd46af74d2695117e62361fe7ae9dfdfe3 (diff) | |
download | cpython-e66987e626cfce8292c39d5b1394665e8aa6840b.tar.gz cpython-e66987e626cfce8292c39d5b1394665e8aa6840b.zip |
os.urandom() now blocks on Linux
Issue #27776: The os.urandom() function does now block on Linux 3.17 and newer
until the system urandom entropy pool is initialized to increase the security.
This change is part of the PEP 524.
Diffstat (limited to 'Lib/random.py')
-rw-r--r-- | Lib/random.py | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/Lib/random.py b/Lib/random.py index 5abcdbcf22b..82f6013b1fe 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -105,15 +105,6 @@ class Random(_random.Random): """ - if a is None: - try: - # Seed with enough bytes to span the 19937 bit - # state space for the Mersenne Twister - a = int.from_bytes(_urandom(2500), 'big') - except NotImplementedError: - import time - a = int(time.time() * 256) # use fractional seconds - if version == 1 and isinstance(a, (str, bytes)): x = ord(a[0]) << 7 if a else 0 for c in a: |