diff -r 00c982c9f681 Lib/test/eintrdata/eintr_tester.py --- a/Lib/test/eintrdata/eintr_tester.py Mon Mar 30 15:04:45 2015 +0200 +++ b/Lib/test/eintrdata/eintr_tester.py Mon Mar 30 18:05:23 2015 +0200 @@ -17,6 +17,8 @@ import unittest from test import support +signal.signal(signal.SIGALRM, lambda *args: None) + @unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()") class EINTRBaseTest(unittest.TestCase): diff -r 00c982c9f681 Lib/test/regrtest.py --- a/Lib/test/regrtest.py Mon Mar 30 15:04:45 2015 +0200 +++ b/Lib/test/regrtest.py Mon Mar 30 18:05:23 2015 +0200 @@ -484,8 +484,8 @@ def main(tests=None, **kwargs): # Display the Python traceback on SIGALRM or SIGUSR1 signal signals = [] - if hasattr(signal, 'SIGALRM'): - signals.append(signal.SIGALRM) + #if hasattr(signal, 'SIGALRM'): + # signals.append(signal.SIGALRM) if hasattr(signal, 'SIGUSR1'): signals.append(signal.SIGUSR1) for signum in signals: @@ -913,6 +913,7 @@ def runtest(test, verbose, quiet, huntrleaks=False, use_resources=None, output_on_failure=False, failfast=False, match_tests=None, timeout=None): + signal.setitimer(signal.ITIMER_REAL, 0.001, 0.001) """Run a single test. test -- the name of the test diff -r 00c982c9f681 Modules/faulthandler.c --- a/Modules/faulthandler.c Mon Mar 30 15:04:45 2015 +0200 +++ b/Modules/faulthandler.c Mon Mar 30 18:05:23 2015 +0200 @@ -662,26 +662,34 @@ faulthandler_user(int signum) user_signal_t *user; PyThreadState *tstate; int save_errno = errno; + static volatile int reentrant = 0; user = &user_signals[signum]; if (!user->enabled) return; + if (!reentrant) { + reentrant = 1; + #ifdef WITH_THREAD - /* PyThreadState_Get() doesn't give the state of the current thread if - the thread doesn't hold the GIL. Read the thread local storage (TLS) - instead: call PyGILState_GetThisThreadState(). */ - tstate = PyGILState_GetThisThreadState(); + /* PyThreadState_Get() doesn't give the state of the current thread if + the thread doesn't hold the GIL. Read the thread local storage (TLS) + instead: call PyGILState_GetThisThreadState(). */ + tstate = PyGILState_GetThisThreadState(); #else - tstate = PyThreadState_Get(); + tstate = PyThreadState_Get(); #endif - if (user->all_threads) - _Py_DumpTracebackThreads(user->fd, user->interp, tstate); - else { - if (tstate != NULL) - _Py_DumpTraceback(user->fd, tstate); + if (user->all_threads) + _Py_DumpTracebackThreads(user->fd, user->interp, tstate); + else { + if (tstate != NULL) + _Py_DumpTraceback(user->fd, tstate); + } + + reentrant = 0; } + #ifdef HAVE_SIGACTION if (user->chain) { (void)sigaction(signum, &user->previous, NULL); diff -r 00c982c9f681 Programs/python.c --- a/Programs/python.c Mon Mar 30 15:04:45 2015 +0200 +++ b/Programs/python.c Mon Mar 30 18:05:23 2015 +0200 @@ -2,6 +2,7 @@ #include "Python.h" #include +#include #ifdef __FreeBSD__ #include @@ -15,6 +16,12 @@ wmain(int argc, wchar_t **argv) } #else +static void +alarm_handler(int sig_num) +{ + return; +} + int main(int argc, char **argv) { @@ -26,6 +33,15 @@ main(int argc, char **argv) #ifdef __FreeBSD__ fp_except_t m; #endif + struct itimerval new, old; + + signal(SIGALRM, alarm_handler); + + new.it_interval.tv_sec = 0; + new.it_interval.tv_usec = 1000; + new.it_value.tv_sec = 0; + new.it_value.tv_usec = 1000; + setitimer(ITIMER_REAL, &new, &old); argv_copy = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1)); argv_copy2 = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));