[issue10824] urandom should not block
Martin v. Löwis
report at bugs.python.org
Tue Jan 4 23:37:41 CET 2011
Martin v. Löwis <martin at v.loewis.de> added the comment:
> "It's a bug in random.c that doesn' t check for signal pending inside the
> read(2) code, so you have no chance to kill the process via signals until
> the read(2) syscall is finished, and it could take a lot of time before
> return, if the buffer given to the read syscall is very big..."
>
> I've had a quick look at the source code, and indeed, read(2) from
> /dev/urandom can now be interrupted by a signal, so looping seems to
> be justified.
No: if read(2) is interrupted, no data is returned, and exception is
raised. So it won't loop in that case, but raise the exception out of
urandom also (which is the right thing to do).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10824>
_______________________________________
More information about the Python-bugs-list
mailing list