From 3fdb23a53d341bb88b9afc7233f53908edd7600a 2011-06-08 22:40:39 From: MinRK Date: 2011-06-08 22:40:39 Subject: [PATCH] properly handle nothing to recv in pykernel._abort_queue copied from ipkernel closes gh-508 --- diff --git a/IPython/zmq/pykernel.py b/IPython/zmq/pykernel.py index 282d8b4..d353c6b 100755 --- a/IPython/zmq/pykernel.py +++ b/IPython/zmq/pykernel.py @@ -174,13 +174,11 @@ class Kernel(HasTraits): def _abort_queue(self): while True: - try: - ident,msg = self.session.recv(self.reply_socket, zmq.NOBLOCK) - except zmq.ZMQError, e: - if e.errno == zmq.EAGAIN: - break + ident,msg = self.session.recv(self.reply_socket, zmq.NOBLOCK) + if msg is None: + break else: - assert ident is not None, "Missing message part." + assert ident is not None, "Unexpected missing message part." print>>sys.__stdout__, "Aborting:" print>>sys.__stdout__, Message(msg) msg_type = msg['msg_type']