Skip to content

Commit e313371

Browse files
committed
Disallow inline config of Python version
Fixes #18450
1 parent c4e2eb7 commit e313371

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mypy/config_parser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,11 @@ def parse_mypy_comments(
608608
# method is to create a config parser.
609609
parser = configparser.RawConfigParser()
610610
options, parse_errors = mypy_comments_to_config_map(line, template)
611+
612+
if "python_version" in options:
613+
errors.append((lineno, "python_version not supported in inline configuration"))
614+
del options["python_version"]
615+
611616
parser["dummy"] = options
612617
errors.extend((lineno, x) for x in parse_errors)
613618

0 commit comments

Comments
 (0)