changeset: 102700:265644bad99e user: Victor Stinner date: Tue Aug 16 15:19:09 2016 +0200 files: Python/random.c description: Issue #27776: _PyRandom_Init() doesn't call PyErr_CheckSignals() anymore Modify py_getrandom() to not call PyErr_CheckSignals() if raise is zero. _PyRandom_Init() is called very early in the Python initialization, so it's safer to not call PyErr_CheckSignals(). diff -r 980e2c781810 -r 265644bad99e Python/random.c --- a/Python/random.c Tue Aug 16 15:23:58 2016 +0200 +++ b/Python/random.c Tue Aug 16 15:19:09 2016 +0200 @@ -191,10 +191,13 @@ } if (errno == EINTR) { - if (PyErr_CheckSignals()) { - return -1; + if (raise) { + if (PyErr_CheckSignals()) { + return -1; + } } - /* retry getrandom() */ + + /* retry getrandom() if it was interrupted by a signal */ continue; }