summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 7709a95..55530fc 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1242,6 +1242,14 @@ def getblock(lines):
blockfinder.tokeneater(*_token)
except (EndOfBlock, IndentationError):
pass
+ except SyntaxError as e:
+ if "unmatched" not in e.msg:
+ raise e from None
+ _, *_token_info = _token
+ try:
+ blockfinder.tokeneater(tokenize.NEWLINE, *_token_info)
+ except (EndOfBlock, IndentationError):
+ pass
return lines[:blockfinder.last]
def getsourcelines(object):