summaryrefslogtreecommitdiffstats
path: root/Python/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/random.c')
-rw-r--r--Python/random.c9
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;
}