File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments