Message253230
I think Jan has a point there. An import should not cause the whole interpreter to hang.
Wouldn't it be possible to have the getrandom() call be done lazily to avoid this and only have it block when the RNG from the random is actually being used ?
Or alternatively, make things more robust by avoiding to call the API on systems which are known to have blocking problems and then reverting to using /dev/urandom directly instead ?
Note that the RNG does already use a fallback solution for systems which don't provide os.urandom. Also note that os.urandom() is documented (indirectly via man 4 urandom) to not be blocking. If it blocks on some systems, we should add a work-around for those, just like Python/random.c does for Solaris.
BTW: Is there a way to determine whether enough entropy has been gathered without doing a blocking call ? This could be used to find out whether getrandom() will potentially block. |
|
Date |
User |
Action |
Args |
2015-10-20 16:26:20 | lemburg | set | recipients:
+ lemburg, rhettinger, vstinner, matejcik, socketpair |
2015-10-20 16:26:20 | lemburg | set | messageid: <1445358380.05.0.625085839576.issue25420@psf.upfronthosting.co.za> |
2015-10-20 16:26:20 | lemburg | link | issue25420 messages |
2015-10-20 16:26:19 | lemburg | create | |
|