mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
SF bug #1022010: Import random fails
* trap NotImplementedError raised by os.urandom calls when not available on a particular system.
This commit is contained in:
parent
0506c64086
commit
bdbdfd731d
1 changed files with 2 additions and 1 deletions
|
@ -62,7 +62,8 @@ RECIP_BPF = 2**-BPF
|
||||||
try:
|
try:
|
||||||
from os import urandom as _urandom
|
from os import urandom as _urandom
|
||||||
from binascii import hexlify as _hexlify
|
from binascii import hexlify as _hexlify
|
||||||
except ImportError:
|
_urandom(1) # verify that urandom is implemented
|
||||||
|
except (ImportError, NotImplementedError):
|
||||||
_urandom = None
|
_urandom = None
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue