mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.11] gh-79871: IDLE - Fix and test debugger module (GH-11451) (#112257)
Add docstrings to the debugger module. Fix two bugs: initialize Idb.botframe (should be in Bdb); In Idb.in_rpc_code, check whether prev_frame is None before trying to use it. Make other code changes.
Expand test_debugger coverage from 19% to 66%.
---------
(cherry picked from commit adedcfa06b
)
Co-authored-by: Anthony Shaw <anthony.p.shaw@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
93fbcd6443
commit
e19d75df76
5 changed files with 397 additions and 74 deletions
|
@ -133,8 +133,8 @@ class PyShellEditorWindow(EditorWindow):
|
|||
def __init__(self, *args):
|
||||
self.breakpoints = []
|
||||
EditorWindow.__init__(self, *args)
|
||||
self.text.bind("<<set-breakpoint-here>>", self.set_breakpoint_here)
|
||||
self.text.bind("<<clear-breakpoint-here>>", self.clear_breakpoint_here)
|
||||
self.text.bind("<<set-breakpoint>>", self.set_breakpoint_event)
|
||||
self.text.bind("<<clear-breakpoint>>", self.clear_breakpoint_event)
|
||||
self.text.bind("<<open-python-shell>>", self.flist.open_shell)
|
||||
|
||||
#TODO: don't read/write this from/to .idlerc when testing
|
||||
|
@ -155,8 +155,8 @@ class PyShellEditorWindow(EditorWindow):
|
|||
("Copy", "<<copy>>", "rmenu_check_copy"),
|
||||
("Paste", "<<paste>>", "rmenu_check_paste"),
|
||||
(None, None, None),
|
||||
("Set Breakpoint", "<<set-breakpoint-here>>", None),
|
||||
("Clear Breakpoint", "<<clear-breakpoint-here>>", None)
|
||||
("Set Breakpoint", "<<set-breakpoint>>", None),
|
||||
("Clear Breakpoint", "<<clear-breakpoint>>", None)
|
||||
]
|
||||
|
||||
def color_breakpoint_text(self, color=True):
|
||||
|
@ -181,11 +181,11 @@ class PyShellEditorWindow(EditorWindow):
|
|||
self.breakpoints.append(lineno)
|
||||
try: # update the subprocess debugger
|
||||
debug = self.flist.pyshell.interp.debugger
|
||||
debug.set_breakpoint_here(filename, lineno)
|
||||
debug.set_breakpoint(filename, lineno)
|
||||
except: # but debugger may not be active right now....
|
||||
pass
|
||||
|
||||
def set_breakpoint_here(self, event=None):
|
||||
def set_breakpoint_event(self, event=None):
|
||||
text = self.text
|
||||
filename = self.io.filename
|
||||
if not filename:
|
||||
|
@ -194,7 +194,7 @@ class PyShellEditorWindow(EditorWindow):
|
|||
lineno = int(float(text.index("insert")))
|
||||
self.set_breakpoint(lineno)
|
||||
|
||||
def clear_breakpoint_here(self, event=None):
|
||||
def clear_breakpoint_event(self, event=None):
|
||||
text = self.text
|
||||
filename = self.io.filename
|
||||
if not filename:
|
||||
|
@ -209,7 +209,7 @@ class PyShellEditorWindow(EditorWindow):
|
|||
"insert lineend +1char")
|
||||
try:
|
||||
debug = self.flist.pyshell.interp.debugger
|
||||
debug.clear_breakpoint_here(filename, lineno)
|
||||
debug.clear_breakpoint(filename, lineno)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue