From 7ff0aac6f3cbf83016a0bac5e6ab121a5927118a Mon Sep 17 00:00:00 2001 From: zerotypic Date: Wed, 5 Feb 2020 16:39:05 +0800 Subject: [PATCH] Temp fix for ipykernel >= 5, handle Future returned by do_one_iteration(). In ipykernel >= 5, do_one_iteration() has been changed into a coroutine and returns a Future. This Future needs to be processed appropriately, if not the kernel will die with an error "execution aborted" (see #26) due to the coroutine not having completed execution. To fix this, have ipython_kernel_iteration() complete execution of the coroutine before continuing. This is just a temporary fix, will need checks so the code works on ipykernel < 5. --- ipyida/kernel.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ipyida/kernel.py b/ipyida/kernel.py index ceaf68b..57e6b78 100644 --- a/ipyida/kernel.py +++ b/ipyida/kernel.py @@ -16,6 +16,8 @@ import os import idaapi +import asyncio + # The IPython kernel will override sys.std{out,err}. We keep a copy to let the # existing embeded IDA console continue working, and also let IPython output to # it. @@ -101,7 +103,8 @@ def start(self): self.connection_file = app.connection_file def ipython_kernel_iteration(): - app.kernel.do_one_iteration() + f = app.kernel.do_one_iteration() + asyncio.get_event_loop().run_until_complete(f) return int(1000 * app.kernel._poll_interval) self._timer = idaapi.register_timer(int(1000 * app.kernel._poll_interval), ipython_kernel_iteration)