summaryrefslogtreecommitdiffstats
path: root/Lib/bdb.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-05-01 02:07:49 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2012-05-01 02:07:49 (GMT)
commit42d7081806444582ee20f6cfdf7e8c88b165b0b0 (patch)
tree117680dc95c15f7853f10bf46ecf9d48db2cb3ab /Lib/bdb.py
parent2e20968feb2eb720fc7906fb1ceb9e7185412610 (diff)
downloadcpython-42d7081806444582ee20f6cfdf7e8c88b165b0b0.zip
cpython-42d7081806444582ee20f6cfdf7e8c88b165b0b0.tar.gz
cpython-42d7081806444582ee20f6cfdf7e8c88b165b0b0.tar.bz2
issue13183 - Fix pdb skipping frames after hitting a breakpoint and running step. Patch by Xavier de Gaye
Diffstat (limited to 'Lib/bdb.py')
-rw-r--r--Lib/bdb.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/bdb.py b/Lib/bdb.py
index f711004..dd1f4287 100644
--- a/Lib/bdb.py
+++ b/Lib/bdb.py
@@ -22,6 +22,7 @@ class Bdb:
self.skip = set(skip) if skip else None
self.breaks = {}
self.fncache = {}
+ self.frame_returning = None
def canonic(self, filename):
if filename == "<" + filename[1:-1] + ">":
@@ -80,7 +81,11 @@ class Bdb:
def dispatch_return(self, frame, arg):
if self.stop_here(frame) or frame == self.returnframe:
- self.user_return(frame, arg)
+ try:
+ self.frame_returning = frame
+ self.user_return(frame, arg)
+ finally:
+ self.frame_returning = None
if self.quitting: raise BdbQuit
return self.trace_dispatch
@@ -186,6 +191,14 @@ class Bdb:
def set_step(self):
"""Stop after one line of code."""
+ # Issue #13183: pdb skips frames after hitting a breakpoint and running
+ # step commands.
+ # Restore the trace function in the caller (that may not have been set
+ # for performance reasons) when returning from the current frame.
+ if self.frame_returning:
+ caller_frame = self.frame_returning.f_back
+ if caller_frame and not caller_frame.f_trace:
+ caller_frame.f_trace = self.trace_dispatch
self._set_stopinfo(None, None)
def set_next(self, frame):