Skip to content

Commit 5a296f0

Browse files
authored
Clean up new_semantic_analyzer config (#18071)
This has been very dead for years, no plugin I can tell is using it
1 parent 58f7628 commit 5a296f0

File tree

4 files changed

+3
-16
lines changed

4 files changed

+3
-16
lines changed

mypy/config_parser.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,7 @@ def parse_section(
472472
)
473473
continue
474474
else:
475-
dv = None
476-
# We have to keep new_semantic_analyzer in Options
477-
# for plugin compatibility but it is not a valid option anymore.
478-
assert hasattr(template, "new_semantic_analyzer")
479-
if key != "new_semantic_analyzer":
480-
dv = getattr(template, key, None)
475+
dv = getattr(template, key, None)
481476
if dv is None:
482477
if key.endswith("_report"):
483478
report_type = key[:-7].replace("_", "-")

mypy/options.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -400,17 +400,12 @@ def use_or_syntax(self) -> bool:
400400
def use_star_unpack(self) -> bool:
401401
return self.python_version >= (3, 11)
402402

403-
# To avoid breaking plugin compatibility, keep providing new_semantic_analyzer
404-
@property
405-
def new_semantic_analyzer(self) -> bool:
406-
return True
407-
408403
def snapshot(self) -> dict[str, object]:
409404
"""Produce a comparable snapshot of this Option"""
410405
# Under mypyc, we don't have a __dict__, so we need to do worse things.
411406
d = dict(getattr(self, "__dict__", ()))
412407
for k in get_class_descriptors(Options):
413-
if hasattr(self, k) and k != "new_semantic_analyzer":
408+
if hasattr(self, k):
414409
d[k] = getattr(self, k)
415410
# Remove private attributes from snapshot
416411
d = {k: v for k, v in d.items() if not k.startswith("_")}

mypy/plugin.py

-3
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@ class C: pass
114114
Note that a forward reference in a function signature won't trigger another
115115
pass, since all functions are processed only after the top level has been fully
116116
analyzed.
117-
118-
You can use `api.options.new_semantic_analyzer` to check whether the new
119-
semantic analyzer is enabled (it's always true in mypy 0.730 and later).
120117
"""
121118

122119
from __future__ import annotations

mypyc/irbuild/builder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def get_assignment_target(
594594
if isinstance(symbol, Decorator):
595595
symbol = symbol.func
596596
if symbol is None:
597-
# New semantic analyzer doesn't create ad-hoc Vars for special forms.
597+
# Semantic analyzer doesn't create ad-hoc Vars for special forms.
598598
assert lvalue.is_special_form
599599
symbol = Var(lvalue.name)
600600
if not for_read and isinstance(symbol, Var) and symbol.is_cls:

0 commit comments

Comments
 (0)