diff -r a064abfd436c Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py Thu Apr 02 17:20:48 2015 +0200 +++ b/Lib/test/test_ssl.py Thu Apr 02 17:32:18 2015 +0200 @@ -2817,6 +2817,11 @@ else: s.close() def test_handshake_timeout(self): + import signal + signal.signal(signal.SIGALRM, lambda *args: None) + self.addCleanup(signal.setitimer, signal.ITIMER_REAL, 0, 0) + signal.setitimer(signal.ITIMER_REAL, 0.001, 0.001) + # Issue #5103: SSL handshake must respect the socket timeout server = socket.socket(socket.AF_INET) host = "127.0.0.1"