summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_signal.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-03 12:11:22 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-03 12:11:22 (GMT)
commit2d4a91e0d0065b89cb9820b10e30f74c362cb430 (patch)
treec506e1b34948fe37a202d8225ac0edb136a59180 /Lib/test/test_signal.py
parent49a40cd56211fee248868754680c1e8601c0c6af (diff)
downloadcpython-2d4a91e0d0065b89cb9820b10e30f74c362cb430.zip
cpython-2d4a91e0d0065b89cb9820b10e30f74c362cb430.tar.gz
cpython-2d4a91e0d0065b89cb9820b10e30f74c362cb430.tar.bz2
Issue #8407: Fix pthread_sigmask() tests on Mac OS X
Disable faulthandler timeout thread on Mac OS X: it interacts with pthread_sigmask() tests.
Diffstat (limited to 'Lib/test/test_signal.py')
-rw-r--r--Lib/test/test_signal.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 809da3a..5caf13d 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -504,6 +504,21 @@ class PthreadSigmaskTests(unittest.TestCase):
def read_sigmask():
return signal.pthread_sigmask(signal.SIG_BLOCK, [])
+ if sys.platform == "darwin":
+ import faulthandler
+ # The fault handler timeout thread masks all signals. If the main
+ # thread masks also SIGUSR1, all threads mask this signal. In this
+ # case, on Mac OS X, if we send SIGUSR1 to the process, the signal
+ # is pending in the main or the faulthandler timeout thread.
+ # Unblock SIGUSR1 in the main thread calls the signal handler only
+ # if the signal is pending for the main thread.
+ #
+ # Stop the faulthandler timeout thread to workaround this problem.
+ # Another solution would be to send the signal directly to the main
+ # thread using pthread_kill(), but Python doesn't expose this
+ # function.
+ faulthandler.cancel_dump_tracebacks_later()
+
old_handler = signal.signal(signum, handler)
self.addCleanup(signal.signal, signum, old_handler)