Skip to content

Commit b5a4d7d

Browse files
committed
Skip overlapping overload check at large overload counts
Fixes python#10004
1 parent 041a8af commit b5a4d7d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎mypy/checker.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,11 @@ def check_overlapping_overloads(self, defn: OverloadedFuncDef) -> None:
668668
# useful for stubs!
669669
return
670670

671+
if len(defn.items) >= 100:
672+
# Skip this check for large numbers of overloads, since the following is quadratic.
673+
# This constant matches the threshold at which pyright similarly skips this check.
674+
return
675+
671676
# Compute some info about the implementation (if it exists) for use below
672677
impl_type: CallableType | None = None
673678
if defn.impl:

0 commit comments

Comments
 (0)