Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyboardInterrupt not handled correctly #296

Open
allefeld opened this issue Oct 8, 2023 · 0 comments
Open

KeyboardInterrupt not handled correctly #296

allefeld opened this issue Oct 8, 2023 · 0 comments

Comments

@allefeld
Copy link

allefeld commented Oct 8, 2023

If I interrupt via Ctrl+C a long-running computation, here simulated by time.sleep, Jupyter Console gets confused:

$ jupyter console
Jupyter console 6.6.3

Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.15.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from time import sleep

In [2]: sleep(15)
^C
KeyboardInterrupt escaped interact()


In [3]: 2+2🤫/lib/python3.10/site-packages/jupyter_console/ptshell.py:787: UserWarning: The kernel did not respond to an is_complete_request. Setting `use_kernel_is_complete` to False.
  warn('The kernel did not respond to an is_complete_request. '
In [3]: 2+2

Out[3]: 4

🤫 replaces the path to my Conda environment.

By "confused" I mean:

  • First there is a cryptic message.
  • Then the next prompt appears, but apparently because the kernel hasn't actually stopped executing the previous code, a tab completeness check request is not responded to.
  • The second line, 2+2 is eventually executed, but there is a delay of several seconds before that.

I first encountered this problem with a Python wrapper kernel I'm developing, but then tested with the default Python kernel. The same thing happens in both, which leads me to believe that this is a bug in Jupyter Console. From what I can tell, the kernel is never notified about the interruption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant