This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iomintz
Recipients asvetlov, iomintz, yselivanov
Date 2019-12-03.00:10:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1575331802.11.0.760790431063.issue38958@roundup.psfhosted.org>
In-reply-to
Content
"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.
History
Date User Action Args
2019-12-03 00:10:02iomintzsetrecipients: + iomintz, asvetlov, yselivanov
2019-12-03 00:10:02iomintzsetmessageid: <1575331802.11.0.760790431063.issue38958@roundup.psfhosted.org>
2019-12-03 00:10:02iomintzlinkissue38958 messages
2019-12-03 00:10:01iomintzcreate