Skip to content

Commit f780828

Browse files
Merge branch 'master' into patch-3
2 parents 50b9597 + 7a32bc1 commit f780828

File tree

93 files changed

+1664
-1682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1664
-1682
lines changed

mypy/messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1784,7 +1784,7 @@ def reveal_locals(self, type_map: dict[str, Type | None], context: Context) -> N
17841784

17851785
def unsupported_type_type(self, item: Type, context: Context) -> None:
17861786
self.fail(
1787-
f'Cannot instantiate type "Type[{format_type_bare(item, self.options)}]"', context
1787+
f'Cannot instantiate type "type[{format_type_bare(item, self.options)}]"', context
17881788
)
17891789

17901790
def redundant_cast(self, typ: Type, context: Context) -> None:

mypy/semanal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3985,7 +3985,7 @@ def check_and_set_up_type_alias(self, s: AssignmentStmt) -> bool:
39853985
if isinstance(existing.node, TypeAlias) and not s.is_alias_def:
39863986
self.fail(
39873987
'Cannot assign multiple types to name "{}"'
3988-
' without an explicit "Type[...]" annotation'.format(lvalue.name),
3988+
' without an explicit "type[...]" annotation'.format(lvalue.name),
39893989
lvalue,
39903990
)
39913991
return False

mypy/suggestions.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
SymbolTable,
5454
TypeInfo,
5555
Var,
56-
reverse_builtin_aliases,
5756
)
5857
from mypy.options import Options
5958
from mypy.plugin import FunctionContext, MethodContext, Plugin
@@ -830,8 +829,6 @@ def visit_instance(self, t: Instance) -> str:
830829
s = t.type.fullname or t.type.name or None
831830
if s is None:
832831
return "<???>"
833-
if s in reverse_builtin_aliases:
834-
s = reverse_builtin_aliases[s]
835832

836833
mod_obj = split_target(self.graph, s)
837834
assert mod_obj

mypy/test/helpers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,12 @@ def local_sys_path_set() -> Iterator[None]:
258258

259259

260260
def testfile_pyversion(path: str) -> tuple[int, int]:
261-
m = re.search(r"python3([0-9]+)\.test$", path)
262-
if m:
263-
return 3, int(m.group(1))
261+
if m := re.search(r"python3([0-9]+)\.test$", path):
262+
# For older unsupported version like python38,
263+
# default to that earliest supported version.
264+
return max((3, int(m.group(1))), defaults.PYTHON3_VERSION_MIN)
264265
else:
265-
return defaults.PYTHON3_VERSION
266+
return defaults.PYTHON3_VERSION_MIN
266267

267268

268269
def normalize_error_messages(messages: list[str]) -> list[str]:
@@ -353,7 +354,6 @@ def parse_options(
353354
options = Options()
354355
options.error_summary = False
355356
options.hide_error_codes = True
356-
options.force_uppercase_builtins = True
357357
options.force_union_syntax = True
358358

359359
# Allow custom python version to override testfile_pyversion.

mypy/test/testcheck.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ def run_case_once(
136136
options.hide_error_codes = False
137137
if "abstract" not in testcase.file:
138138
options.allow_empty_bodies = not testcase.name.endswith("_no_empty")
139-
if "lowercase" not in testcase.file:
140-
options.force_uppercase_builtins = True
141139
if "union-error" not in testcase.file:
142140
options.force_union_syntax = True
143141

mypy/test/testcmdline.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ def test_python_cmdline(testcase: DataDrivenTestCase, step: int) -> None:
6161
args.append("--hide-error-codes")
6262
if "--disallow-empty-bodies" not in args:
6363
args.append("--allow-empty-bodies")
64-
if "--no-force-uppercase-builtins" not in args:
65-
args.append("--force-uppercase-builtins")
6664
if "--no-force-union-syntax" not in args:
6765
args.append("--force-union-syntax")
6866
# Type check the program.

mypy/test/testmerge.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def build(self, source: str, testcase: DataDrivenTestCase) -> BuildResult | None
102102
options.export_types = True
103103
options.show_traceback = True
104104
options.allow_empty_bodies = True
105-
options.force_uppercase_builtins = True
106105
main_path = os.path.join(test_temp_dir, "main")
107106

108107
self.str_conv.options = options

mypy/test/testparse.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def test_parser(testcase: DataDrivenTestCase) -> None:
3838
The argument contains the description of the test case.
3939
"""
4040
options = Options()
41-
options.force_uppercase_builtins = True
4241
options.hide_error_codes = True
4342

4443
if testcase.file.endswith("python310.test"):

mypy/test/testpythoneval.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def test_python_evaluation(testcase: DataDrivenTestCase, cache_dir: str) -> None
5252
"--no-error-summary",
5353
"--hide-error-codes",
5454
"--allow-empty-bodies",
55-
"--force-uppercase-builtins",
5655
"--test-env", # Speeds up some checks
5756
]
5857
interpreter = python3_path

mypy/test/testsemanal.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def get_semanal_options(program_text: str, testcase: DataDrivenTestCase) -> Opti
4444
options.semantic_analysis_only = True
4545
options.show_traceback = True
4646
options.python_version = PYTHON3_VERSION
47-
options.force_uppercase_builtins = True
4847
return options
4948

5049

0 commit comments

Comments
 (0)