mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
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().
This commit is contained in:
parent
4bad3b622e
commit
cecdd9634b
1 changed files with 6 additions and 3 deletions
|
@ -191,10 +191,13 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
if (PyErr_CheckSignals()) {
|
if (raise) {
|
||||||
return -1;
|
if (PyErr_CheckSignals()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* retry getrandom() */
|
|
||||||
|
/* retry getrandom() if it was interrupted by a signal */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue