From 5a296f055cf138e5080014cfd36eae77a1d9ed37 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Wed, 30 Oct 2024 12:09:23 -0700 Subject: [PATCH] Clean up new_semantic_analyzer config (#18071) This has been very dead for years, no plugin I can tell is using it --- mypy/config_parser.py | 7 +------ mypy/options.py | 7 +------ mypy/plugin.py | 3 --- mypyc/irbuild/builder.py | 2 +- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/mypy/config_parser.py b/mypy/config_parser.py index a6bf021000c1..9fa99333a42a 100644 --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -472,12 +472,7 @@ def parse_section( ) continue else: - dv = None - # We have to keep new_semantic_analyzer in Options - # for plugin compatibility but it is not a valid option anymore. - assert hasattr(template, "new_semantic_analyzer") - if key != "new_semantic_analyzer": - dv = getattr(template, key, None) + dv = getattr(template, key, None) if dv is None: if key.endswith("_report"): report_type = key[:-7].replace("_", "-") diff --git a/mypy/options.py b/mypy/options.py index d315d297e023..367267d1053a 100644 --- a/mypy/options.py +++ b/mypy/options.py @@ -400,17 +400,12 @@ def use_or_syntax(self) -> bool: def use_star_unpack(self) -> bool: return self.python_version >= (3, 11) - # To avoid breaking plugin compatibility, keep providing new_semantic_analyzer - @property - def new_semantic_analyzer(self) -> bool: - return True - def snapshot(self) -> dict[str, object]: """Produce a comparable snapshot of this Option""" # Under mypyc, we don't have a __dict__, so we need to do worse things. d = dict(getattr(self, "__dict__", ())) for k in get_class_descriptors(Options): - if hasattr(self, k) and k != "new_semantic_analyzer": + if hasattr(self, k): d[k] = getattr(self, k) # Remove private attributes from snapshot d = {k: v for k, v in d.items() if not k.startswith("_")} diff --git a/mypy/plugin.py b/mypy/plugin.py index a4dc0052ec79..fcbbc32f6237 100644 --- a/mypy/plugin.py +++ b/mypy/plugin.py @@ -114,9 +114,6 @@ class C: pass Note that a forward reference in a function signature won't trigger another pass, since all functions are processed only after the top level has been fully analyzed. - -You can use `api.options.new_semantic_analyzer` to check whether the new -semantic analyzer is enabled (it's always true in mypy 0.730 and later). """ from __future__ import annotations diff --git a/mypyc/irbuild/builder.py b/mypyc/irbuild/builder.py index 823f1581ba2e..4a5647b9ffdf 100644 --- a/mypyc/irbuild/builder.py +++ b/mypyc/irbuild/builder.py @@ -594,7 +594,7 @@ def get_assignment_target( if isinstance(symbol, Decorator): symbol = symbol.func if symbol is None: - # New semantic analyzer doesn't create ad-hoc Vars for special forms. + # Semantic analyzer doesn't create ad-hoc Vars for special forms. assert lvalue.is_special_form symbol = Var(lvalue.name) if not for_read and isinstance(symbol, Var) and symbol.is_cls: