Skip to content

Commit 35e0de2

Browse files
author
huajie.liu
committed
fix blocking issue when cell contains ipywidget
1 parent a72fb94 commit 35e0de2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

nbclient/client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,10 +768,12 @@ async def _async_poll_for_reply(
768768
) -> dict[str, t.Any]:
769769
msg: dict[str, t.Any]
770770
assert self.kc is not None
771-
new_timeout: float | None = None
772771
if timeout is not None:
773772
deadline = monotonic() + timeout
774773
new_timeout = float(timeout)
774+
else:
775+
deadline = monotonic() + 5
776+
new_timeout = float(5)
775777
error_on_timeout_execute_reply = None
776778
while True:
777779
try:
@@ -800,7 +802,10 @@ async def _async_poll_for_reply(
800802
new_timeout = max(0, deadline - monotonic())
801803
except Empty:
802804
# received no message, check if kernel is still alive
803-
assert timeout is not None
805+
if timeout is None:
806+
deadline = monotonic() + 5
807+
new_timeout = float(5)
808+
continue
804809
task_poll_kernel_alive.cancel()
805810
await self._async_check_alive()
806811
error_on_timeout_execute_reply = await self._async_handle_timeout(timeout, cell)

0 commit comments

Comments
 (0)