diff options
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index ceaea5a..5cb958b 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -657,7 +657,9 @@ def getblock(lines): """Extract the block of code at the top of the given list of lines.""" blockfinder = BlockFinder() try: - tokenize.tokenize(iter(lines).__next__, blockfinder.tokeneater) + tokens = tokenize.generate_tokens(iter(lines).__next__) + for _token in tokens: + blockfinder.tokeneater(*_token) except (EndOfBlock, IndentationError): pass return lines[:blockfinder.last] |