Skip to content

Print KeyboardInterrupt twice when ctrl+c in default asyncio REPL #139845

Closed

Description

@yihong0618

Bug report

Bug description:

➜  cpython git:(main) ./python.exe -m asyncio
asyncio REPL 3.15.0a0 (heads/main-dirty:6f3dae0dc5, Oct  6 2025, 18:22:15) [Clang 17.0.0 (clang-1700.0.13.5)] on darwin
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> await asyncio.sleep(200)
^C
KeyboardInterrupt
>>> 
KeyboardInterrupt
>>> 

its normal in basic REPL


➜  cpython git:(main) PYTHON_BASIC_REPL=1 ./python.exe -m asyncio
asyncio REPL 3.15.0a0 (heads/main-dirty:6f3dae0dc5, Oct  6 2025, 18:22:15) [Clang 17.0.0 (clang-1700.0.13.5)] on darwin
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> await asyncio.sleep(200)
^C
KeyboardInterrupt
>>> 

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Oct 9, 2025
  2. added a commit that references this issue on Oct 9, 2025
  3. added a commit that references this issue on Oct 9, 2025
  4. moved this from Todo to Done in asyncioon Oct 9, 2025
  5. added a commit that references this issue on Oct 9, 2025
  6. added 2 commits that reference this issue on Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-asynciotopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions