Skip to content

remote pdb can not attach when breakpoint() and exit #139688

@yihong0618

Description

@yihong0618

Bug report

Bug description:

reproduce

on terminal

./python.exe
breakpoint()
# ctrl + D

another terminal

sudo ./python.exe -m pdb -p $(pid)

more can check png below
Image

Image

debug:

Pdb._last_pdb_instance still when do_quit in repl so remote pdb can not exec in it

fix:

diff --git a/Lib/pdb.py b/Lib/pdb.py
index f695a39332..3e32c50f96 100644
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -2008,6 +2008,7 @@ def do_quit(self, arg):
                     return
 
         self._user_requested_quit = True
+        Pdb._last_pdb_instance = None
         self.set_quit()
         return 1
 

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/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions