Nick Coghlan added the comment:

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).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27266>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to