[Python-checkins] python/dist/src/Lib inspect.py,1.49,1.50

akuchling at users.sourceforge.net akuchling at users.sourceforge.net
Sat Jun 5 10:12:01 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32149

Modified Files:
	inspect.py 
Log Message:
[Bug #954364] inspect.getframeinfo() sometimes produces incorrect traceback line #s; fix is to look at tb.tb_lineno, not tb.frame.f_lineno.  Patch from Robin Becker and me.

Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** inspect.py	1 Dec 2003 20:12:15 -0000	1.49
--- inspect.py	5 Jun 2004 14:11:59 -0000	1.50
***************
*** 741,750 ****
      to return, which are centered around the current line."""
      if istraceback(frame):
          frame = frame.tb_frame
      if not isframe(frame):
          raise TypeError('arg is not a frame or traceback object')
  
      filename = getsourcefile(frame) or getfile(frame)
-     lineno = frame.f_lineno
      if context > 0:
          start = lineno - 1 - context//2
--- 741,752 ----
      to return, which are centered around the current line."""
      if istraceback(frame):
+         lineno = frame.tb_lineno
          frame = frame.tb_frame
+     else:
+         lineno = frame.f_lineno
      if not isframe(frame):
          raise TypeError('arg is not a frame or traceback object')
  
      filename = getsourcefile(frame) or getfile(frame)
      if context > 0:
          start = lineno - 1 - context//2




More information about the Python-checkins mailing list