From 5c7654936f58f2bb89951a79fb59227d6cd9e206 Mon Sep 17 00:00:00 2001 From: Dmitri Gavrilov Date: Wed, 13 Sep 2023 15:58:19 -0400 Subject: [PATCH] Fix behavior in response to Ctrl-C --- jupyter_console/ptshell.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jupyter_console/ptshell.py b/jupyter_console/ptshell.py index 12fb38b..3496805 100644 --- a/jupyter_console/ptshell.py +++ b/jupyter_console/ptshell.py @@ -639,7 +639,9 @@ async def interact(self, loop=None, display_banner=None): print('\n', end='') try: + real_handler = signal.getsignal(signal.SIGINT) code = await self.prompt_for_code() + signal.signal(signal.SIGINT, real_handler) except EOFError: if (not self.confirm_exit) or \ ask_yes_no('Do you really want to exit ([y]/n)?', 'y', 'n'):