title: python script not terminating after timeout in ZMQ recv()
body: <p>This is my first time working with IPC so far and I have written this script:</p>
  
  <pre><code>#!/usr/bin/python
  
  import zmq
  
  context = zmq.Context()
  socket = context.socket(zmq.PAIR)
  socket.setsockopt(zmq.RCVTIMEO, 2000)
  socket.connect ("ipc:///tmp/something")
  socket.send(b"123")
  try:
      message = socket.recv()
  except:
      print("DEBUG!")
      message = None
  </code></pre>
  
  <p>When my server script is running ( it simply sends an answer ) everything is working fine.</p>
  
  <p>But when the <strong><code>.recv()</code></strong>-call timeouts ( e.g. because there is no server running ), the script won't terminate after the "DEBUG!"-print and I have to manually stop it using <kbd>Ctrl</kbd>+<kbd>C</kbd>.</p>
  
  <p>I tried disconnecting and closing the socket, but it doesn't change anything.</p>
  
  <p>When I put the whole script into a function and call it, I get the following error on <strong><code>KeyboardInterrupt:</code></strong></p>
  
  <pre><code>^CException ignored in: &lt;bound method Context.__del__ of &lt;zmq.sugar.context.Context object at 0x7f16a36d5128&gt;&gt;
  Traceback (most recent call last):
    File "/usr/lib/python3.6/site-packages/zmq/sugar/context.py", line 46, in __del__
      self.term()
    File "zmq/backend/cython/context.pyx", line 136, in zmq.backend.cython.context.Context.term (zmq/backend/cython/context.c:2339)
    File "zmq/backend/cython/checkrc.pxd", line 12, in zmq.backend.cython.checkrc._check_rc (zmq/backend/cython/context.c:3207)
  KeyboardInterrupt
  </code></pre>
  
  <p>I'm running Python 3.6.1 and version 16.0.2 of the PyZMQ module on an Arch Linux.</p>