[Python-checkins] CVS: python/dist/src/Lib profile.py,1.36,1.37
Tim Peters
tim_one@users.sourceforge.net
Sat, 06 Oct 2001 21:30:55 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv32041/python/Lib
Modified Files:
profile.py
Log Message:
At Guido's request, changed the code that's conceptually asserting stuff
to use assert stmts (was raising unexpected kinds of exceptions).
Index: profile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/profile.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** profile.py 2001/10/07 04:02:36 1.36
--- profile.py 2001/10/07 04:30:53 1.37
***************
*** 253,263 ****
rt, rtt, rct, rfn, rframe, rcur = self.cur
if not isinstance(rframe, Profile.fake_frame):
! if rframe.f_back is not frame.f_back:
! print rframe, rframe.f_back
! print frame, frame.f_back
! raise "Bad call", self.cur[-3]
self.trace_dispatch_return(rframe, 0)
! if self.cur and frame.f_back is not self.cur[-2]:
! raise "Bad call[2]", self.cur[-3]
fcode = frame.f_code
fn = (fcode.co_filename, fcode.co_firstlineno, fcode.co_name)
--- 253,263 ----
rt, rtt, rct, rfn, rframe, rcur = self.cur
if not isinstance(rframe, Profile.fake_frame):
! assert rframe.f_back is frame.f_back, ("Bad call", rfn,
! rframe, rframe.f_back,
! frame, frame.f_back)
self.trace_dispatch_return(rframe, 0)
! assert (self.cur is None or \
! frame.f_back is self.cur[-2]), ("Bad call",
! self.cur[-3])
fcode = frame.f_code
fn = (fcode.co_filename, fcode.co_firstlineno, fcode.co_name)
***************
*** 273,280 ****
def trace_dispatch_return(self, frame, t):
if frame is not self.cur[-2]:
! if frame is self.cur[-2].f_back:
! self.trace_dispatch_return(self.cur[-2], 0)
! else:
! raise "Bad return", self.cur[-3]
# Prefix "r" means part of the Returning or exiting frame
--- 273,278 ----
def trace_dispatch_return(self, frame, t):
if frame is not self.cur[-2]:
! assert frame is self.cur[-2].f_back, ("Bad return", self.cur[-3])
! self.trace_dispatch_return(self.cur[-2], 0)
# Prefix "r" means part of the Returning or exiting frame
***************
*** 312,316 ****
! # The next few function play with self.cmd. By carefully preloading
# our parallel stack, we can force the profiled result to include
# an arbitrary string as the name of the calling function.
--- 310,314 ----
! # The next few functions play with self.cmd. By carefully preloading
# our parallel stack, we can force the profiled result to include
# an arbitrary string as the name of the calling function.