From 90cda6d05bc2d7726dd4e3ca4a23caf5674d6022 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Sat, 8 Oct 2022 17:50:31 -0700 Subject: [PATCH] stubtest: catch SyntaxError from inspect.getsourcelines Fixes #13822 --- mypy/stubtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/stubtest.py b/mypy/stubtest.py index 4b3175e8649f..87ccbd3176df 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -136,7 +136,7 @@ def get_description(self, concise: bool = False) -> str: if not isinstance(self.runtime_object, Missing): try: runtime_line = inspect.getsourcelines(self.runtime_object)[1] - except (OSError, TypeError): + except (OSError, TypeError, SyntaxError): pass try: runtime_file = inspect.getsourcefile(self.runtime_object)