[Python-checkins] cpython: Issue #8407: disable faulthandler timeout thread on all platforms
victor.stinner
python-checkins at python.org
Tue May 3 17:20:52 CEST 2011
http://hg.python.org/cpython/rev/96a532eaa2d1
changeset: 69803:96a532eaa2d1
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Tue May 03 17:20:31 2011 +0200
summary:
Issue #8407: disable faulthandler timeout thread on all platforms
The problem is not specific to Mac OS X.
files:
Lib/test/test_signal.py | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -494,6 +494,7 @@
self.assertRaises(RuntimeError, signal.pthread_sigmask, 1700, [])
def test_block_unlock(self):
+ import faulthandler
pid = os.getpid()
signum = signal.SIGUSR1
@@ -503,20 +504,18 @@
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()
+ # The fault handler timeout thread masks all signals. If the main
+ # thread masks also SIGUSR1, all threads mask this signal. In this
+ # case, 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()
# Install our signal handler
old_handler = signal.signal(signum, handler)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list