Author ncoghlan
Recipients Lukasa, Theodore Tso, christian.heimes, dstufft, larry, lemburg, martin.panter, ncoghlan, vstinner
Date 2016-06-09.17:21:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1465492914.17.0.641667388555.issue27266@psf.upfronthosting.co.za>
In-reply-to
Content
Since Victor requested it, I filed #27282 to track the "raise BlockingIOError if the kernel would block" design option.

The key advantage that particular model offers is that it's trivial to build a blocking version as a busy loop around the non-blocking version:

    def urandom_wait_for_entropy(num_bytes):
        while True:
            try:
                return os.urandom(num_bytes)
            except BlockingIOError:
                pass

And if you ignore the problem and just call os.urandom(), you'll almost certainly be fine unless you're working with Linux boot scripts or embedded ARM devices (in which case, this point will be minor compared to the other arcana you're dealing with).
History
Date User Action Args
2016-06-09 17:21:54ncoghlansetrecipients: + ncoghlan, lemburg, vstinner, larry, christian.heimes, martin.panter, dstufft, Lukasa, Theodore Tso
2016-06-09 17:21:54ncoghlansetmessageid: <1465492914.17.0.641667388555.issue27266@psf.upfronthosting.co.za>
2016-06-09 17:21:54ncoghlanlinkissue27266 messages
2016-06-09 17:21:53ncoghlancreate