[issue21305] PEP 466: update os.urandom
STINNER Victor
report at bugs.python.org
Tue Apr 29 10:37:46 CEST 2014
STINNER Victor added the comment:
> The problem is AFAICT there's currently no way to get a file
> descriptor to the underlying /dev/urandom (and I don't know how it
> works on Windows).
We can reimplement os.urandom in SystemRandom on UNIX to keep the file (fd)
open. The code is very simple, basically it's just a call to file.read(n).
Adding a randbytes() method in Python 3.5 would be nice.
The io module can handle boring things for you, like calling read in a loop
until you get enough bytes and handle InterruptError.
Except if you would prefer to use os.read or FileIO.read to avoid readahead.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21305>
_______________________________________
More information about the Python-bugs-list
mailing list