From 53d497b1b0e0349b7ef449082d80c9fd6c505884 2011-07-16 22:46:55 From: MinRK Date: 2011-07-16 22:46:55 Subject: [PATCH] never call Queue.get(block=True, timeout=None) get(block=True, timeout=None) is uninterruptible. Replacing this with timeout=1e6 is effectively forever, but respects interrupts. --- diff --git a/IPython/zmq/blockingkernelmanager.py b/IPython/zmq/blockingkernelmanager.py index 884aed9..362632d 100644 --- a/IPython/zmq/blockingkernelmanager.py +++ b/IPython/zmq/blockingkernelmanager.py @@ -48,6 +48,10 @@ class BlockingSubSocketChannel(SubSocketChannel): def get_msg(self, block=True, timeout=None): """Get a message if there is one that is ready.""" + if block and timeout is None: + # never use timeout=None, because get + # becomes uninterruptible + timeout = 1e6 return self._in_queue.get(block, timeout) def get_msgs(self): @@ -81,6 +85,10 @@ class BlockingShellSocketChannel(ShellSocketChannel): def get_msg(self, block=True, timeout=None): """Get a message if there is one that is ready.""" + if block and timeout is None: + # never use timeout=None, because get + # becomes uninterruptible + timeout = 1e6 return self._in_queue.get(block, timeout) def get_msgs(self):