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 baf5e59

Browse filesBrowse files
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 25a3d64 commit baf5e59
Copy full SHA for baf5e59

File tree

1 file changed

+1
-1
lines changed
Filter options

1 file changed

+1
-1
lines changed

‎mypy/typeshed/stdlib/builtins.pyi

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/builtins.pyi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ _SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWit
16991699
# without creating many false-positive errors (see #7578).
17001700
# Instead, we special-case the most common examples of this: bool and literal integers.
17011701
@overload
1702-
def sum(iterable: Iterable[bool | _LiteralInteger], /, start: int = 0) -> int: ...
1702+
def sum(iterable: Iterable[bool], /, start: int = 0) -> int: ...
17031703
@overload
17041704
def sum(iterable: Iterable[_SupportsSumNoDefaultT], /) -> _SupportsSumNoDefaultT | Literal[0]: ...
17051705
@overload

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.