From 1fbbe91c84ca1d26168d4d5eaec8888222e2e3c6 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Sun, 9 Oct 2022 07:17:45 -0700 Subject: [PATCH] stubtest: catch SyntaxError from inspect.getsourcelines (#13848) 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)