[New-bugs-announce] [issue38958] asyncio REPL swallows KeyboardInterrupt while editing
Io Mintz
report at bugs.python.org
Mon Dec 2 19:10:02 EST 2019
New submission from Io Mintz <io at mintz.cc>:
"python3 -m asyncio" swallows KeyboardInterrupt while editing a line.
Problem steps:
==============
- run python -m asyncio
- press ^C
Expected behavior (normal CPython REPL, as well as python -m code):
==================================================================
The current input line is abandoned and "\nKeyboardInterrupt" is printed.
Sample for "spam^C" with the normal REPL:
-----------------------------------------
Python 3.8.0 (default, Oct 23 2019, 18:51:26)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> spam
KeyboardInterrupt
Python 3.9.0a1+ (heads/master:a62ad4730c, Dec 2 2019, 17:38:37)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> spam
KeyboardInterrupt
Sample for "spam^C" in the InteractiveConsole REPL, as invoked by `python -m code`:
-----------------------------------------------------------------------------------
Python 3.8.0 (default, Oct 23 2019, 18:51:26)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> spam
KeyboardInterrupt
Python 3.9.0a1+ (heads/master:a62ad4730c, Dec 2 2019, 17:38:37)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> spam
KeyboardInterrupt
Actual behavior:
================
The KeyboardInterrupt is ignored, the current input line remains on screen, and a new line is not started:
asyncio REPL 3.8.0 (default, Oct 23 2019, 18:51:26)
[GCC 9.2.0] on linux
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> spam
asyncio REPL 3.9.0a1+ (heads/master:a62ad4730c, Dec 2 2019, 17:38:37)
[GCC 9.2.0] on linux
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> spam
Workaround
==========
If editing a continued block (ie a line prefixed by sys.ps2 / "..."), enter any invalid syntax (such as unindented code) to cancel the current block. If editing a single line, press ^U to clear the line.
OS Details
==========
Arch Linux, python extra/python 3.8.0-1.
----------
components: asyncio
messages: 357738
nosy: asvetlov, iomintz, yselivanov
priority: normal
severity: normal
status: open
title: asyncio REPL swallows KeyboardInterrupt while editing
versions: Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38958>
_______________________________________
More information about the New-bugs-announce
mailing list