[Python-checkins] python/dist/src/Lib bdb.py,1.33.6.1,1.33.6.2

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Tue, 28 May 2002 18:17:49 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv20577

Modified Files:
      Tag: release22-maint
	bdb.py 
Log Message:
Backport fix by tismer for #210682

fixed an old buglet that caused bdb to be unable to
continue in the botframe, after a breakpoint was set.
the key idea is not to set botframe to the bottom level frame,
but its f_back, which actually might be None.
Additional changes: migrated old exception trick to use
sys._getframe(), which exists both in 2.1 and 2.2 .

Note: I believe Mark Hammond needs to look over his code now.
F5 correctly starts up in the debugger, but later on doesn't stop at a given
breakpoint any longer.

kind regards - chris



Index: bdb.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/bdb.py,v
retrieving revision 1.33.6.1
retrieving revision 1.33.6.2
diff -C2 -d -r1.33.6.1 -r1.33.6.2
*** bdb.py	28 Feb 2002 10:00:34 -0000	1.33.6.1
--- bdb.py	29 May 2002 01:17:47 -0000	1.33.6.2
***************
*** 65,69 ****
          if self.botframe is None:
              # First call of dispatch since reset()
!             self.botframe = frame
              return self.trace_dispatch
          if not (self.stop_here(frame) or self.break_anywhere(frame)):
--- 65,69 ----
          if self.botframe is None:
              # First call of dispatch since reset()
!             self.botframe = frame.f_back # (CT) Note that this may also be None!
              return self.trace_dispatch
          if not (self.stop_here(frame) or self.break_anywhere(frame)):
***************
*** 91,96 ****
  
      def stop_here(self, frame):
!         if self.stopframe is None:
!             return 1
          if frame is self.stopframe:
              return 1
--- 91,96 ----
  
      def stop_here(self, frame):
!         # (CT) stopframe may now also be None, see dispatch_call.
!         # (CT) the former test for None is therefore removed from here.
          if frame is self.stopframe:
              return 1
***************
*** 169,176 ****
      def set_trace(self):
          """Start debugging from here."""
!         try:
!             1 + ''
!         except:
!             frame = sys.exc_info()[2].tb_frame.f_back
          self.reset()
          while frame:
--- 169,173 ----
      def set_trace(self):
          """Start debugging from here."""
!         frame = sys._getframe().f_back
          self.reset()
          while frame:
***************
*** 189,196 ****
              # no breakpoints; run without debugger overhead
              sys.settrace(None)
!             try:
!                 1 + ''  # raise an exception
!             except:
!                 frame = sys.exc_info()[2].tb_frame.f_back
              while frame and frame is not self.botframe:
                  del frame.f_trace
--- 186,190 ----
              # no breakpoints; run without debugger overhead
              sys.settrace(None)
!             frame = sys._getframe().f_back
              while frame and frame is not self.botframe:
                  del frame.f_trace