title: Python3 vs. Python2 signal SIGALRM handling difference
body: <p>I'm evaluating expressions that may take excessive time. I would like to set up a timeout, for example:</p>
  
  <pre><code>def handler(signum, frame):                                                                     
      print("handler called")                                                                     
      raise Exception("timed out")                                                                                                                                       
  
  def eval_wrapped(expr, timeout=1):                                                              
      signal.signal(signal.SIGALRM, handler)                                                      
      signal.alarm(timeout)                                                                       
      eval(expr)                                                                                  
      signal.alarm(0)                                                                             
      return None                                                                                 
  </code></pre>
  
  <p>Running</p>
  
  <pre><code>&gt; eval_wrapped("9999**9999**9999")
  </code></pre>
  
  <p>in:</p>
  
  <p>Python2: throws the expected Exception</p>
  
  <p>Python3: prints only "handler called", does not throw Exception</p>
  
  <p>What's up here? How to make the above work in Python3?</p>