Author haypo
Recipients alex, benjamin.peterson, christian.heimes, dstufft, giampaolo.rodola, haypo, janssen, josh.r, ncoghlan, neologix, tshepang
Date 2014-04-29.08:37:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwbHNz9BTfMq6c346Cmo9_peH++8JKTFtwiaoyp3DSaPDA@mail.gmail.com>
In-reply-to <CAH_1eM0XDZCGZmZQU5=DKKfhrrnsU_Rqz=-Otxfni-SsxsRagg@mail.gmail.com>
Content
> 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.
History
Date User Action Args
2014-04-29 08:37:46hayposetrecipients: + haypo, ncoghlan, janssen, giampaolo.rodola, christian.heimes, benjamin.peterson, alex, neologix, tshepang, dstufft, josh.r
2014-04-29 08:37:46haypolinkissue21305 messages
2014-04-29 08:37:45haypocreate