Skip to content

Commit 73ae49d

Browse files
committed
-
1 parent 1dba7da commit 73ae49d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

ipykernel/kernelbase.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,6 @@ async def shell_main(self, subshell_id: str | None):
424424
if subshell_id is None:
425425
# Main subshell.
426426
await to_thread.run_sync(self.shell_stop.wait)
427-
428-
if not self._eventloop_set.is_set():
429-
# Stop the async task that is waiting for the eventloop to be set.
430-
self._eventloop_set.set()
431-
432427
tg.cancel_scope.cancel()
433428

434429
async def process_shell(self, socket=None):
@@ -580,6 +575,10 @@ async def start(self, *, task_status: TaskStatus = TASK_STATUS_IGNORED) -> None:
580575
tg.start_soon(self.shell_main, None)
581576

582577
def stop(self):
578+
if not self._eventloop_set.is_set():
579+
# Stop the async task that is waiting for the eventloop to be set.
580+
self._eventloop_set.set()
581+
583582
self.shell_stop.set()
584583
self.control_stop.set()
585584

0 commit comments

Comments
 (0)