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

SourceForge.net noreply@sourceforge.net
Sun, 19 Jan 2003 05:26:07 -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: Closed
>Resolution: Accepted
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: Raymond Hettinger (rhettinger)
Date: 2003-01-19 08:26

Message:
Logged In: YES 
user_id=80475

I spent a little time testing this one and checked to make 
sure it didn't clash with my fixes.

Marking as accepted and applying as Lib/inspect 1.41.

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

Comment By: Patrick K. O'Brien (pobrien)
Date: 2002-11-06 17: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 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