python -m asyncio and breakpoint() will fovever error loop and mess up the terminal
Open
Nobody has claimed this yet.
- #138617 by @yihong0618 — closed without merging
stdlib
topic-repl
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction using ./python.exe -m asyncio, breakpoint(), and two n commands in the Pdb prompt. Read Lib/asyncio/__main__.py around callback() lines 57-58 and inspect the terminal behavior shown in the report; done means the asyncio REPL no longer corrupts or repeatedly errors in this flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100