Skip to content

Commit

Permalink
Execute code in blocking mode by default
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Apr 22, 2024
1 parent a7d66ae commit fdcef67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions ipykernel/ipkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ async def run(execution: Execution) -> None:
try:
async with create_task_group() as tg:
execution = Execution()
self.shell_is_blocking = False
self.shell_is_awaiting = True
tg.start_soon(run, execution)
execution.interrupt = await to_thread.run_sync(self.shell_interrupt.get)
Expand Down
2 changes: 2 additions & 0 deletions ipykernel/kernelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,9 @@ async def execute_request(self, socket, ident, parent):
do_execute_args["cell_id"] = cell_id

# Call do_execute with the appropriate arguments
self.shell_is_blocking = True
reply_content = self.do_execute(**do_execute_args)
self.shell_is_blocking = False

if inspect.isawaitable(reply_content):
reply_content = await reply_content
Expand Down

0 comments on commit fdcef67

Please sign in to comment.