From 2e7b748a9ecc2d21abe0ecf93e079ac53385c371 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sun, 19 Jan 2003 13:21:20 +0000 Subject: [PATCH] SF patch #634557: inspect.BlockFinder didn't do a good enough job finding the end of code blocks. Patch contributed by Patrick O'Brien. --- Lib/inspect.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/inspect.py b/Lib/inspect.py index 77129fd7324..80f65b53ba9 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -501,6 +501,8 @@ def tokeneater(self, type, token, (srow, scol), (erow, ecol), line): 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."""