Skip to content

python -m asyncio and breakpoint() will fovever error loop and mess up the terminal #138827

@yihong0618

Description

@yihong0618

Bug report

Bug description:

# Add a code block here, if required
➜  cpython git:(main) ./python.exe -m asyncio
asyncio REPL 3.15.0a0 (heads/hy/close_new_repl_error_mess:b194f8fae6, Sep 12 2025, 19:50:01) [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
>>> breakpoint()
> <python-input-0>(1)<module>()
(Pdb) n
--Return--
> <python-input-0>(1)<module>()->None
(Pdb) n
> /Users/yihong/repos/cpython/Lib/asyncio/__main__.py(57)callback()
-> if not inspect.iscoroutine(coro):
(Pdb) n
> /Users/yihong/repos/cpython/Lib/asyncio/__main__.py(58)callback()
-> future.set_result(coro)
(Pdb)

then type n twice the terminal will boom

Image

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-asynciotype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions