diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-08-16 13:19:09 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-08-16 13:19:09 (GMT) |
commit | cecdd9634b8ca3f0b260681d75cc1fd00a350efd (patch) | |
tree | 281efa62b8f541c76a4747963edfc36fb99089fb /Python/random.c | |
parent | 4bad3b622e119cea330e0c0a8a6dc26b98f17d53 (diff) | |
download | cpython-cecdd9634b8ca3f0b260681d75cc1fd00a350efd.zip cpython-cecdd9634b8ca3f0b260681d75cc1fd00a350efd.tar.gz cpython-cecdd9634b8ca3f0b260681d75cc1fd00a350efd.tar.bz2 |
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().
Diffstat (limited to 'Python/random.c')
-rw-r--r-- | Python/random.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/random.c b/Python/random.c index 7d37fe9..4d0eabc 100644 --- a/Python/random.c +++ b/Python/random.c @@ -191,10 +191,13 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise) } 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; } |