Skip to content

Commit 55c717e

Browse files
committed
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 eset#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.
1 parent 8ef7bdf commit 55c717e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ipyida/kernel.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import os
1717
import idaapi
1818

19+
import asyncio
20+
1921
# The IPython kernel will override sys.std{out,err}. We keep a copy to let the
2022
# existing embeded IDA console continue working, and also let IPython output to
2123
# it.
@@ -102,7 +104,8 @@ def start(self):
102104
self.connection_file = app.connection_file
103105

104106
def ipython_kernel_iteration():
105-
app.kernel.do_one_iteration()
107+
f = app.kernel.do_one_iteration()
108+
asyncio.get_event_loop().run_until_complete(f)
106109
return int(1000 * app.kernel._poll_interval)
107110
self._timer = idaapi.register_timer(int(1000 * app.kernel._poll_interval), ipython_kernel_iteration)
108111

0 commit comments

Comments
 (0)