From de7d467ed5a8b5a4e98451cbdbc51d06a13bde72 Mon Sep 17 00:00:00 2001 From: Open Source Contributor Date: Tue, 5 May 2026 16:19:39 -0600 Subject: [PATCH] Fix output config option in mypy.ini The config parser was skipping options whose default value is None (e.g. 'output'), even when the attribute exists on the Options class. This was due to the condition 'dv is None' being used to skip unknown options, but some valid options intentionally have None defaults. The fix changes the condition to skip only options that don't exist on the template Options object (using hasattr), allowing options like 'output' to be set in config files. Fixes #21376 --- mypy/config_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/config_parser.py b/mypy/config_parser.py index 97fa01b8dd215..b95d059e94d87 100644 --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -521,7 +521,7 @@ def parse_section( continue else: dv = getattr(template, options_key, None) - if dv is None: + if dv is None and not hasattr(template, options_key): if key.endswith("_report"): report_type = key[:-7].replace("_", "-") if report_type in defaults.REPORTER_NAMES: