From 46ed1fc7866eee3f27e6dbf2c786a6a88f6b4365 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Sat, 16 Sep 2023 00:41:52 -0700 Subject: [PATCH] Fix mypyc regression with pretty Fixes #15877 Regression was introduced by #15070. Previously Errors objects created in mypyc build would just use all the default values, now they use the actual options object involved --- mypy/errors.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mypy/errors.py b/mypy/errors.py index a678b790cb8c..4e62a48aeb27 100644 --- a/mypy/errors.py +++ b/mypy/errors.py @@ -909,8 +909,7 @@ def file_messages(self, path: str) -> list[str]: return [] self.flushed_files.add(path) source_lines = None - if self.options.pretty: - assert self.read_source + if self.options.pretty and self.read_source: source_lines = self.read_source(path) return self.format_messages(self.error_info_map[path], source_lines)