Skip to content

quit breakpoint() from asyncio repl is different behavior with normal repl(new) #138899

@yihong0618

Description

@yihong0618

Bug report

Bug description:

# normal breakpoint() quite in repl
Python 3.15.0a0 (heads/main:3e06cfcaee, Sep 15 2025, 08:36:03) [Clang 17.0.0 (clang-1700.0.13.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> breakpoint()
> <python-input-0>(1)<module>()
(Pdb) q
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    breakpoint()
    ~~~~~~~~~~^^
  File "/Users/hyi/prs/cpython/Lib/bdb.py", line 94, in wrapper
    ret = func(frame, *args)
  File "/Users/hyi/prs/cpython/Lib/bdb.py", line 154, in opcode_callback
    frame.f_trace(frame, 'opcode', None)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hyi/prs/cpython/Lib/bdb.py", line 289, in trace_dispatch
    return self.dispatch_opcode(frame, arg)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/hyi/prs/cpython/Lib/bdb.py", line 408, in dispatch_opcode
    if self.quitting: raise BdbQuit
                      ^^^^^^^^^^^^^
bdb.BdbQuit

# asyncio repl quit breakpoint

➜  cpython git:(hy/asyncio_repl_breakpoint) ✗ ./python.exe -m asyncio
asyncio REPL 3.15.0a0 (heads/main:3e06cfcaee, Sep 15 2025, 08:36:03) [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) q
Quitting pdb will kill the process. Quit anyway? [y/n] 

I checked the issues

refer issue #124703

and patch
#130395

in asyncio repl we do not for sure has ps1 in sys

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions