]> granicus.if.org Git - python/commitdiff
SF patch #634557: inspect.BlockFinder didn't do a good enough job finding
authorRaymond Hettinger <python@rcn.com>
Sun, 19 Jan 2003 13:21:20 +0000 (13:21 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 19 Jan 2003 13:21:20 +0000 (13:21 +0000)
the end of code blocks.

Patch contributed by Patrick O'Brien.

Lib/inspect.py

index 77129fd7324d7e0e194cea51e3dfe3c431d6bd7f..80f65b53ba95e21bfe170d1128f772d2947db38a 100644 (file)
@@ -501,6 +501,8 @@ class BlockFinder:
         elif type == tokenize.DEDENT:
             self.indent = self.indent - 1
             if self.indent == 0: raise EndOfBlock, self.last
+        elif type == tokenize.NAME and scol == 0:
+            raise EndOfBlock, self.last
 
 def getblock(lines):
     """Extract the block of code at the top of the given list of lines."""