From 3a95da32d1b6abd080958c8baf463ba216f26afb Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 3 Mar 2023 11:04:43 -0600 Subject: [PATCH 1/2] fix handle_external_iopub again --- jupyter_console/ptshell.py | 5 +++-- jupyter_console/utils.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jupyter_console/ptshell.py b/jupyter_console/ptshell.py index 0f9e4f3..12fb38b 100644 --- a/jupyter_console/ptshell.py +++ b/jupyter_console/ptshell.py @@ -76,7 +76,7 @@ from pygments.util import ClassNotFound from pygments.token import Token -from jupyter_console.utils import run_sync +from jupyter_console.utils import run_sync, ensure_async def ask_yes_no(prompt, default=None, interrupt=None): @@ -839,9 +839,10 @@ def include_output(self, msg): async def handle_external_iopub(self, loop=None): while self.keep_running: # we need to check for keep_running from time to time - poll_result = run_sync(self.client.iopub_channel.socket.poll)(500) + poll_result = await ensure_async(self.client.iopub_channel.socket.poll(0)) if poll_result: self.handle_iopub() + await asyncio.sleep(0.5) def handle_iopub(self, msg_id=''): """Process messages on the IOPub channel diff --git a/jupyter_console/utils.py b/jupyter_console/utils.py index 5fb767b..48d2374 100644 --- a/jupyter_console/utils.py +++ b/jupyter_console/utils.py @@ -1,6 +1,6 @@ import inspect import typing as t -from jupyter_core.utils import run_sync as _run_sync +from jupyter_core.utils import run_sync as _run_sync, ensure_async T = t.TypeVar("T") From 86412a402b615e386b4278d8b8359ca72524d367 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 3 Mar 2023 11:07:48 -0600 Subject: [PATCH 2/2] lint --- jupyter_console/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter_console/utils.py b/jupyter_console/utils.py index 48d2374..2f9035b 100644 --- a/jupyter_console/utils.py +++ b/jupyter_console/utils.py @@ -1,6 +1,6 @@ import inspect import typing as t -from jupyter_core.utils import run_sync as _run_sync, ensure_async +from jupyter_core.utils import run_sync as _run_sync, ensure_async # noqa T = t.TypeVar("T")