(original) (raw)
changeset: 69795:d003ce770ba1 user: Victor Stinner victor.stinner@haypocalc.com date: Tue May 03 14:11:22 2011 +0200 files: Lib/test/test_signal.py description: Issue #8407: Fix pthread_sigmask() tests on Mac OS X Disable faulthandler timeout thread on Mac OS X: it interacts with pthread_sigmask() tests. diff -r d074f18291f7 -r d003ce770ba1 Lib/test/test_signal.py --- a/Lib/test/test_signal.py Mon May 02 22:30:06 2011 -0500 +++ b/Lib/test/test_signal.py Tue May 03 14:11:22 2011 +0200 @@ -504,6 +504,21 @@ 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) /victor.stinner@haypocalc.com