summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-09-03 19:09:22 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-09-03 19:09:22 (GMT)
commitbdbdfd731dc2bf4b5490254c0df4b7c7e90ef751 (patch)
treecca77698d3a35db77890d30b57619ead8f41cc8a
parent0506c64086e2535335a58b9368d2b940abbf8c11 (diff)
downloadcpython-bdbdfd731dc2bf4b5490254c0df4b7c7e90ef751.zip
cpython-bdbdfd731dc2bf4b5490254c0df4b7c7e90ef751.tar.gz
cpython-bdbdfd731dc2bf4b5490254c0df4b7c7e90ef751.tar.bz2
SF bug #1022010: Import random fails
* trap NotImplementedError raised by os.urandom calls when not available on a particular system.
-rw-r--r--Lib/random.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/random.py b/Lib/random.py
index 0047c91..e6f6e4b 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -62,7 +62,8 @@ RECIP_BPF = 2**-BPF
try:
from os import urandom as _urandom
from binascii import hexlify as _hexlify
-except ImportError:
+ _urandom(1) # verify that urandom is implemented
+except (ImportError, NotImplementedError):
_urandom = None