Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainCorlay committed Mar 8, 2021
1 parent 19d189d commit 137112e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ipykernel/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class ControlThread(Thread):

def __init__(self, log=None, **kwargs):
def __init__(self, **kwargs):
Thread.__init__(self, **kwargs)
self.io_loop = IOLoop(make_current=False)
self.pydev_do_not_trace = True
Expand Down
8 changes: 6 additions & 2 deletions ipykernel/kernelapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ def init_control(self, context):

self.debug_shell_socket = context.socket(zmq.DEALER)
self.debug_shell_socket.linger = 1000
self.debug_shell_socket.connect(self.shell_socket.getsockopt(zmq.LAST_ENDPOINT))
if self.shell_socket.getsockopt(zmq.LAST_ENDPOINT):
self.debug_shell_socket.connect(self.shell_socket.getsockopt(zmq.LAST_ENDPOINT))

if hasattr(zmq, 'ROUTER_HANDOVER'):
# set router-handover to workaround zeromq reconnect problems
Expand Down Expand Up @@ -345,7 +346,10 @@ def close(self):
self.iopub_thread.stop()
self.iopub_thread.close()

self.debug_shell_socket.close()
if self.debugpy_socket and not self.debugpy_socket.closed:
self.debugpy_socket.close()
if self.debug_shell_socket and not self.debug_shell_socket.closed:
self.debug_shell_socket.close()

for channel in ('shell', 'control', 'stdin'):
self.log.debug("Closing %s channel", channel)
Expand Down
4 changes: 2 additions & 2 deletions ipykernel/kernelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ def __init__(self, **kwargs):
self.session)

self.control_queue = Queue()
kwargs['control_thread'].io_loop.add_callback(self.poll_control_queue)

if 'control_thread' in kwargs:
kwargs['control_thread'].io_loop.add_callback(self.poll_control_queue)

@gen.coroutine
def dispatch_debugpy(self, msg):
Expand Down

0 comments on commit 137112e

Please sign in to comment.