[Patches] [ python-Patches-634557 ] Better inspect.BlockFinder fixes bug

noreply@sourceforge.net noreply@sourceforge.net
Wed, 06 Nov 2002 14:55:11 -0800


Patches item #634557, was opened at 2002-11-06 12:04
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=634557&group_id=5470

Category: Library (Lib)
Group: Python 2.2.x
Status: Open
Resolution: None
Priority: 5
Submitted By: Patrick K. O'Brien (pobrien)
Assigned to: Nobody/Anonymous (nobody)
Summary: Better inspect.BlockFinder fixes bug

Initial Comment:
inspect.BlockFinder didn't do a good enough job finding  
the end of code blocks. This can be observed by  
running:  
  
>>> import inspect  
>>> import tokenize  
>>> print inspect.getsource(tokenize.TokenError)  
class TokenError(Exception): pass  
  
class StopTokenizing(Exception): pass  
  
def printtoken(type, token, (srow, scol), (erow, ecol),  
line): # for testing  
    print "%d,%d-%d,%d:\t%s\t%s" % \  
        (srow, scol, erow, ecol, tok_name[type],  
repr(token))  
  
>>>   
  
Notice how it picks up extra source code lines. The  
attached patch fixes this problem. There should probably 
be some additional unit tests for this, but I ran out of time 
and energy. 

----------------------------------------------------------------------

>Comment By: Patrick K. O'Brien (pobrien)
Date: 2002-11-06 16:55

Message:
Logged In: YES 
user_id=179604

Yes, this does fix bug # 595018. I'll look at the other inspect 
module bugs when I've got some spare time. 

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-06 16:41

Message:
Logged In: YES 
user_id=33168

Does this fix bug # 595018?  There are a few other inspect
module bugs I think.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=634557&group_id=5470