Skip to content

Commit da2d27f

Browse files
committed
Add optional name parameter to start_soon for improved task identification
1 parent 02c59e8 commit da2d27f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ipykernel/kernelbase.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,13 @@ def pre_handler_hook(self):
583583
def post_handler_hook(self):
584584
"""Hook to execute after calling message handler"""
585585

586-
def start_soon(self, func, *args):
586+
def start_soon(self, func, *args, name: str | None = None):
587587
"Run a coroutine in the main thread taskgroup."
588588
try:
589589
if self._portal._event_loop_thread_id == threading.get_ident():
590-
self._tg_main.start_soon(func, *args)
590+
self._tg_main.start_soon(func, *args, name=name)
591591
else:
592-
self._portal.start_task_soon(func, *args)
592+
self._portal.start_task_soon(func, *args, name=name)
593593
except Exception:
594594
self.log.exception("portal call failed")
595595
raise

0 commit comments

Comments
 (0)