Skip to content

Commit 7a39ef5

Browse files
committed
fix #16935 use builtins.type not ABCMeta as tuple type obj fallback
i.e. the mypy type of the expression union[str, int] is a CallableType with fallback builtins.type this matches the mypy type of the expression int which is a CallableType with fallback builtins.type (suggested by PR review discussion)
1 parent 5e1b3ff commit 7a39ef5

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

mypy/checkexpr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4846,7 +4846,7 @@ def apply_type_arguments_to_callable(
48464846
[ARG_POS],
48474847
["p1"],
48484848
TupleType(list(args), self.chk.named_type("tuple")),
4849-
self.chk.named_type("abc.ABCMeta"),
4849+
self.chk.named_type("builtins.type"),
48504850
name="tuple",
48514851
definition=tp.definition,
48524852
bound_args=tp.bound_args,

test-data/unit/check-incremental.test

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,8 +3696,8 @@ cache_fine_grained = False
36963696
[file mypy.ini.2]
36973697
\[mypy]
36983698
cache_fine_grained = True
3699-
[rechecked _typeshed, a, abc, builtins, typing]
3700-
[stale _typeshed, a, abc, builtins, typing]
3699+
[rechecked _typeshed, a, builtins, typing]
3700+
[stale _typeshed, a, builtins, typing]
37013701
[builtins fixtures/tuple.pyi]
37023702

37033703
[case testIncrementalPackageNameOverload]
@@ -3748,8 +3748,8 @@ Signature: 8a477f597d28d172789f06886806bc55
37483748
[file b.py.2]
37493749
# uh
37503750
-- Every file should get reloaded, since the cache was invalidated
3751-
[stale _typeshed, a, abc, b, builtins, typing]
3752-
[rechecked _typeshed, a, abc, b, builtins, typing]
3751+
[stale _typeshed, a, b, builtins, typing]
3752+
[rechecked _typeshed, a, b, builtins, typing]
37533753
[builtins fixtures/tuple.pyi]
37543754

37553755
[case testIncrementalBustedFineGrainedCache2]
@@ -3761,8 +3761,8 @@ import b
37613761
[file b.py.2]
37623762
# uh
37633763
-- Every file should get reloaded, since the settings changed
3764-
[stale _typeshed, a, abc, b, builtins, typing]
3765-
[rechecked _typeshed, a, abc, b, builtins, typing]
3764+
[stale _typeshed, a, b, builtins, typing]
3765+
[rechecked _typeshed, a, b, builtins, typing]
37663766
[builtins fixtures/tuple.pyi]
37673767

37683768
[case testIncrementalBustedFineGrainedCache3]
@@ -3777,8 +3777,8 @@ import b
37773777
[file b.py.2]
37783778
# uh
37793779
-- Every file should get reloaded, since the cache was invalidated
3780-
[stale _typeshed, a, abc, b, builtins, typing]
3781-
[rechecked _typeshed, a, abc, b, builtins, typing]
3780+
[stale _typeshed, a, b, builtins, typing]
3781+
[rechecked _typeshed, a, b, builtins, typing]
37823782
[builtins fixtures/tuple.pyi]
37833783

37843784
[case testIncrementalWorkingFineGrainedCache]

test-data/unit/fixtures/tuple.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import _typeshed
44
from typing import Iterable, Iterator, TypeVar, Generic, Sequence, Optional, overload, Tuple, Type
5-
from abc import ABCMeta
65

76
T = TypeVar("T")
87
Tco = TypeVar('Tco', covariant=True)

0 commit comments

Comments
 (0)