Skip to content

Commit

Permalink
only flush stream in dispatch_shell if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilipp authored May 26, 2019
1 parent b81632e commit c3f6e61
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ipykernel/kernelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ def dispatch_shell(self, stream, msg):
self._publish_status(u'idle')
# flush to ensure reply is sent before
# handling the next request
stream.flush(zmq.POLLOUT)
try:
stream.flush(zmq.POLLOUT)
except AttributeError:
pass
return

msg_type = msg['header']['msg_type']
Expand Down Expand Up @@ -283,7 +286,10 @@ def dispatch_shell(self, stream, msg):
self._publish_status(u'idle')
# flush to ensure reply is sent before
# handling the next request
stream.flush(zmq.POLLOUT)
try:
stream.flush(zmq.POLLOUT)
except AttributeError:
pass

def pre_handler_hook(self):
"""Hook to execute before calling message handler"""
Expand Down

0 comments on commit c3f6e61

Please sign in to comment.