Commit 25038ecf authored by Antoine Pitrou's avatar Antoine Pitrou Committed by GitHub

bpo-33329: Fix multiprocessing regression on newer glibcs (GH-6575)

Starting with glibc 2.27.9000-xxx, sigaddset() can return EINVAL for some
reserved signal numbers between 1 and NSIG.  The `range(1, NSIG)` idiom
is commonly used to select all signals for blocking with `pthread_sigmask`.
So we ignore the sigaddset() return value until we expose sigfillset()
to provide a better idiom.
parent c2d384db
Fix multiprocessing regression on newer glibcs
...@@ -819,7 +819,6 @@ iterable_to_sigset(PyObject *iterable, sigset_t *mask) ...@@ -819,7 +819,6 @@ iterable_to_sigset(PyObject *iterable, sigset_t *mask)
int result = -1; int result = -1;
PyObject *iterator, *item; PyObject *iterator, *item;
long signum; long signum;
int err;
sigemptyset(mask); sigemptyset(mask);
...@@ -841,11 +840,14 @@ iterable_to_sigset(PyObject *iterable, sigset_t *mask) ...@@ -841,11 +840,14 @@ iterable_to_sigset(PyObject *iterable, sigset_t *mask)
Py_DECREF(item); Py_DECREF(item);
if (signum == -1 && PyErr_Occurred()) if (signum == -1 && PyErr_Occurred())
goto error; goto error;
if (0 < signum && signum < NSIG) if (0 < signum && signum < NSIG) {
err = sigaddset(mask, (int)signum); /* bpo-33329: ignore sigaddset() return value as it can fail
else * for some reserved signals, but we want the `range(1, NSIG)`
err = 1; * idiom to allow selecting all valid signals.
if (err) { */
(void) sigaddset(mask, (int)signum);
}
else {
PyErr_Format(PyExc_ValueError, PyErr_Format(PyExc_ValueError,
"signal number %ld out of range", signum); "signal number %ld out of range", signum);
goto error; goto error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment