Skip to content

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

@yihong0618

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

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