Skip to content

Commit f8f7eb7

Browse files
committed
Create _control_lock before its users
1 parent 0f613fc commit f8f7eb7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎ipykernel/kernelbase.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,11 +567,12 @@ def start(self):
567567
"""register dispatchers for streams"""
568568
self.io_loop = ioloop.IOLoop.current()
569569

570+
# Create the lock before the control_stream, so the lock is guaranteed to be available.
571+
self._control_lock = asyncio.Lock()
572+
570573
if self.control_stream:
571574
self.control_stream.on_recv(self.dispatch_control, copy=False)
572575

573-
self._control_lock = asyncio.Lock()
574-
575576
if self.shell_stream:
576577
if self.shell_channel_thread:
577578
self.shell_channel_thread.manager.set_on_recv_callback(self.shell_main)

0 commit comments

Comments
 (0)