Skip to content

Commit

Permalink
Disallow inline config of Python version
Browse files Browse the repository at this point in the history
Fixes #18450
  • Loading branch information
hauntsaninja committed Jan 21, 2025
1 parent c4e2eb7 commit e313371
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mypy/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,11 @@ def parse_mypy_comments(
# method is to create a config parser.
parser = configparser.RawConfigParser()
options, parse_errors = mypy_comments_to_config_map(line, template)

if "python_version" in options:
errors.append((lineno, "python_version not supported in inline configuration"))
del options["python_version"]

parser["dummy"] = options
errors.extend((lineno, x) for x in parse_errors)

Expand Down

0 comments on commit e313371

Please sign in to comment.