8000 Revert sum literal integer change (#13961) · python/mypy@72d79d5 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 72d79d5

Browse files
hauntsaninjamypybot
authored and
mypybot
committed
Revert sum literal integer change (#13961)
This is allegedly causing large performance problems, see 13821 typeshed/8231 had zero hits on mypy_primer, so it's not the worst thing to undo. Patching this in typeshed also feels weird, since there's a more general soundness issue. If a typevar has a bound or constraint, we might not want to solve it to a Literal. If we can confirm the performance regression or fix the unsoundness within mypy, I might pursue upstreaming this in typeshed. (Reminder: add this to the sync_typeshed script once merged)
1 parent 8366046 commit 72d79d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mypy/typeshed/stdlib/builtins.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,11 +1563,11 @@ _SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWit
15631563
# Instead, we special-case the most common examples of this: bool and literal integers.
15641564
if sys.version_info >= (3, 8):
15651565
@overload
1566-
def sum(__iterable: Iterable[bool | _LiteralInteger], start: int = ...) -> int: ... # type: ignore[misc]
1566+
def sum(__iterable: Iterable[bool], start: int = ...) -> int: ... # type: ignore[misc]
15671567

15681568
else:
15691569
@overload
1570-
def sum(__iterable: Iterable[bool | _LiteralInteger], __start: int = ...) -> int: ... # type: ignore[misc]
1570+
def sum(__iterable: Iterable[bool], __start: int = ...) -> int: ... # type: ignore[misc]
15711571

15721572
@overload
15731573
def sum(__iterable: Iterable[_SupportsSumNoDefaultT]) -> _SupportsSumNoDefaultT | Literal[0]: ...

0 commit comments

Comments
 (0)
0