File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 99
1010class ControlThread (Thread ):
1111
12- def __init__ (self , log = None , ** kwargs ):
12+ def __init__ (self , ** kwargs ):
1313 Thread .__init__ (self , ** kwargs )
1414 self .io_loop = IOLoop (make_current = False )
1515 self .pydev_do_not_trace = True
Original file line number Diff line number Diff line change @@ -301,7 +301,8 @@ def init_control(self, context):
301301
302302 self .debug_shell_socket = context .socket (zmq .DEALER )
303303 self .debug_shell_socket .linger = 1000
304- self .debug_shell_socket .connect (self .shell_socket .getsockopt (zmq .LAST_ENDPOINT ))
304+ if self .shell_socket .getsockopt (zmq .LAST_ENDPOINT ):
305+ self .debug_shell_socket .connect (self .shell_socket .getsockopt (zmq .LAST_ENDPOINT ))
305306
306307 if hasattr (zmq , 'ROUTER_HANDOVER' ):
307308 # set router-handover to workaround zeromq reconnect problems
@@ -345,7 +346,8 @@ def close(self):
345346 self .iopub_thread .stop ()
346347 self .iopub_thread .close ()
347348
348- self .debug_shell_socket .close ()
349+ if self .debug_shell_socket and not self .debug_shell_socket .closed :
350+ self .debug_shell_socket .close ()
349351
350352 for channel in ('shell' , 'control' , 'stdin' ):
351353 self .log .debug ("Closing %s channel" , channel )
Original file line number Diff line number Diff line change @@ -187,8 +187,8 @@ def __init__(self, **kwargs):
187187 self .session )
188188
189189 self .control_queue = Queue ()
190- kwargs [ 'control_thread' ]. io_loop . add_callback ( self . poll_control_queue )
191-
190+ if 'control_thread' in kwargs :
191+ kwargs [ 'control_thread' ]. io_loop . add_callback ( self . poll_control_queue )
192192
193193 @gen .coroutine
194194 def dispatch_debugpy (self , msg ):
You can’t perform that action at this time.
0 commit comments