Blame 302-fix-multiprocessing-regression-on-newer-glibcs.patch

18c888e
# HG changeset patch
18c888e
# User Miro HronĨok <miro@hroncok.cz>
18c888e
# Date 1524655710 -7200
18c888e
#      Wed Apr 25 13:28:30 2018 +0200
18c888e
# Branch issue33329
18c888e
# Node ID 6501fdc3a80fa2bc3b8c70bfaf94a31c3b3432c0
18c888e
# Parent  a07f07034d281bec8c776f9e1ee7c5b9aea74007
18c888e
Fix multiprocessing regression on newer glibcs
18c888e
18c888e
Starting with glibc 2.27.9000-xxx, sigaddset() can return EINVAL for some
18c888e
reserved signal numbers between 1 and NSIG.  The `range(1, NSIG)` idiom
18c888e
is commonly used to select all signals for blocking with `pthread_sigmask`.
18c888e
So we ignore the sigaddset() return value until we expose sigfillset()
18c888e
to provide a better idiom.
18c888e
18c888e
Co-authored-by: Antoine Pitrou <antoine@python.org>
18c888e
18c888e
diff -r a07f07034d28 -r 6501fdc3a80f pypy/module/signal/interp_signal.py
18c888e
--- a/pypy/module/signal/interp_signal.py	Tue Apr 24 10:00:00 2018 +0200
18c888e
+++ b/pypy/module/signal/interp_signal.py	Wed Apr 25 13:28:30 2018 +0200
18c888e
@@ -379,10 +379,10 @@
18c888e
         for w_signum in space.unpackiterable(self.w_signals):
18c888e
             signum = space.int_w(w_signum)
18c888e
             check_signum_in_range(space, signum)
18c888e
-            err = c_sigaddset(self.mask, signum)
18c888e
-            if err:
18c888e
-                raise oefmt(space.w_ValueError,
18c888e
-                            "signal number %d out of range", signum)
18c888e
+            # bpo-33329: ignore c_sigaddset() return value as it can fail
18c888e
+            # for some reserved signals, but we want the `range(1, NSIG)`
18c888e
+            # idiom to allow selecting all valid signals.
18c888e
+            c_sigaddset(self.mask, signum)
18c888e
         return self.mask
18c888e
 
18c888e
     def __exit__(self, *args):