-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotopic-replRelated to the interactive shellRelated to the interactive shelltype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
It's a little confusing now.
❯ python -m asyncio
asyncio REPL 3.14.0a4+ (heads/main:7d275611f62, Jan 27 2025, 05:41:56) [GCC 11.4.0] on linux
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> raise KeyboardInterrupt
KeyboardInterrupt
>>> ❯ python
Python 3.14.0a4+ (heads/main:7d275611f62, Jan 27 2025, 05:41:56) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> raise KeyboardInterrupt
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
raise KeyboardInterrupt
KeyboardInterrupt
>>> Two options here:
-
Remove specialcasing of
KeyboardInterruptin the asyncio REPL
cpython/Lib/asyncio/__main__.py
Lines 73 to 77 in bb5c687
except BaseException: if keyboard_interrupted: self.write("\nKeyboardInterrupt\n") else: self.showtraceback() -
Specialcase
KeyboardInterruptin the main REPL too, as is in the asyncio REPL
What would you opt for?
Me personally -- 1 (show traceback).
CC @ambv
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotopic-replRelated to the interactive shellRelated to the interactive shelltype-featureA feature request or enhancementA feature request or enhancement
Projects
Status
Todo