Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d4a91e

Browse files
author
Victor Stinner
committed
Issue #8407: Fix pthread_sigmask() tests on Mac OS X
Disable faulthandler timeout thread on Mac OS X: it interacts with pthread_sigmask() tests.
1 parent 49a40cd commit 2d4a91e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Lib/test/test_signal.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,21 @@ def handler(signum, frame):
504504
def read_sigmask():
505505
return signal.pthread_sigmask(signal.SIG_BLOCK, [])
506506

507+
if sys.platform == "darwin":
508+
import faulthandler
509+
# The fault handler timeout thread masks all signals. If the main
510+
# thread masks also SIGUSR1, all threads mask this signal. In this
511+
# case, on Mac OS X, if we send SIGUSR1 to the process, the signal
512+
# is pending in the main or the faulthandler timeout thread.
513+
# Unblock SIGUSR1 in the main thread calls the signal handler only
514+
# if the signal is pending for the main thread.
515+
#
516+
# Stop the faulthandler timeout thread to workaround this problem.
517+
# Another solution would be to send the signal directly to the main
518+
# thread using pthread_kill(), but Python doesn't expose this
519+
# function.
520+
faulthandler.cancel_dump_tracebacks_later()
521+
507522
old_handler = signal.signal(signum, handler)
508523
self.addCleanup(signal.signal, signum, old_handler)
509524

0 commit comments

Comments
 (0)