SF patch #634557: inspect.BlockFinder didn't do a good enough job finding
the end of code blocks. Patch contributed by Patrick O'Brien.
This commit is contained in:
parent
e701dcbabd
commit
2e7b748a9e
|
@ -501,6 +501,8 @@ class BlockFinder:
|
||||||
elif type == tokenize.DEDENT:
|
elif type == tokenize.DEDENT:
|
||||||
self.indent = self.indent - 1
|
self.indent = self.indent - 1
|
||||||
if self.indent == 0: raise EndOfBlock, self.last
|
if self.indent == 0: raise EndOfBlock, self.last
|
||||||
|
elif type == tokenize.NAME and scol == 0:
|
||||||
|
raise EndOfBlock, self.last
|
||||||
|
|
||||||
def getblock(lines):
|
def getblock(lines):
|
||||||
"""Extract the block of code at the top of the given list of lines."""
|
"""Extract the block of code at the top of the given list of lines."""
|
||||||
|
|
Loading…
Reference in New Issue