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

noreply@sourceforge.net noreply@sourceforge.net
Wed, 06 Nov 2002 14:41:46 -0800


Patches item #634557, was opened at 2002-11-06 13: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: Neal Norwitz (nnorwitz)
Date: 2002-11-06 17: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