Skip to content

Commit 1fbbe91

Browse files
authored
stubtest: catch SyntaxError from inspect.getsourcelines (#13848)
Fixes #13822
1 parent 366b7e1 commit 1fbbe91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/stubtest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def get_description(self, concise: bool = False) -> str:
136136
if not isinstance(self.runtime_object, Missing):
137137
try:
138138
runtime_line = inspect.getsourcelines(self.runtime_object)[1]
139-
except (OSError, TypeError):
139+
except (OSError, TypeError, SyntaxError):
140140
pass
141141
try:
142142
runtime_file = inspect.getsourcefile(self.runtime_object)

0 commit comments

Comments
 (0)