Skip to content

Revert "Added support for tracking multiple constraint sets when perf…#10863

Merged
erictraut merged 1 commit intomainfrom
issue-10849
Aug 30, 2025
Merged

Revert "Added support for tracking multiple constraint sets when perf…#10863
erictraut merged 1 commit intomainfrom
issue-10849

Conversation

@erictraut
Copy link
Collaborator

…orming protocol matching. This allows protocols with overloaded methods to contribute independent constraint sets. This addresses #9835. (#9864)"

This reverts commit 131f56d.

This addresses #10849

…orming protocol matching. This allows protocols with overloaded methods to contribute independent constraint sets. This addresses #9835. (#9864)"

This reverts commit 131f56d.

This addresses #10849
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

sympy (https://github.com/sympy/sympy)
+   .../projects/sympy/sympy/crypto/tests/test_crypto.py:475:22 - error: Argument of type "int | Unknown | None" cannot be assigned to parameter "base" of type "_SupportsSomeKindOfPow" in function "pow"
+     Type "int | Unknown | None" is not assignable to type "_SupportsSomeKindOfPow"
+       Type "None" is not assignable to type "_SupportsSomeKindOfPow"
+         "None" is incompatible with protocol "_SupportsPow2[Any, Any]"
+           "__pow__" is not present
+         "None" is incompatible with protocol "_SupportsPow3NoneOnly[Any, Any]"
+           "__pow__" is not present
+         "None" is incompatible with protocol "_SupportsPow3[Any, Any, Any]"
+           "__pow__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/crypto/tests/test_crypto.py:475:22 - error: Argument of type "int | Unknown | None" cannot be assigned to parameter "base" of type "_SupportsPow3[_E_contra@pow, _M_contra@pow, _T_co@pow]" in function "pow"
+   .../projects/sympy/sympy/crypto/tests/test_crypto.py:475:29 - error: Argument of type "int | None" cannot be assigned to parameter "mod" of type "None" in function "pow"
+     Type "int | None" is not assignable to type "None"
+       "int" is not assignable to "None" (reportArgumentType)
-     Type "int | Unknown | None" is not assignable to type "_SupportsPow3[int | Unknown, int | None, _T_co@pow]"
-       "int" is incompatible with protocol "_SupportsPow3[int | Unknown, int | None, _T_co@pow]"
-         "__pow__" is an incompatible type
-           No overloaded function matches type "(other: _E_contra@_SupportsPow3, modulo: _M_contra@_SupportsPow3, /) -> _T_co@_SupportsPow3" (reportArgumentType)
-   .../projects/sympy/sympy/discrete/transforms.py:165:14 - error: Argument of type "int | Unknown | None" cannot be assigned to parameter "base" of type "_SupportsPow3[_E_contra@pow, _M_contra@pow, _T_co@pow]" in function "pow"
+   .../projects/sympy/sympy/discrete/transforms.py:165:14 - error: Argument of type "int | Unknown | None" cannot be assigned to parameter "base" of type "int" in function "pow"
-     Type "int | Unknown | None" is not assignable to type "_SupportsPow3[Any | int, int, int]"
+     Type "int | Unknown | None" is not assignable to type "int"
+       "None" is not assignable to "int" (reportArgumentType)
-       "None" is incompatible with protocol "_SupportsPow3[Any | int, int, int]"
-         "__pow__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/ntheory/tests/test_residue.py:127:20 - error: Argument of type "int | None" cannot be assigned to parameter "base" of type "_SupportsPow3[_E_contra@pow, _M_contra@pow, _T_co@pow]" in function "pow"
+   .../projects/sympy/sympy/ntheory/tests/test_residue.py:127:20 - error: Argument of type "int | None" cannot be assigned to parameter "base" of type "int" in function "pow"
-     Type "int | None" is not assignable to type "_SupportsPow3[int, int, int]"
+     Type "int | None" is not assignable to type "int"
+       "None" is not assignable to "int" (reportArgumentType)
-       "None" is incompatible with protocol "_SupportsPow3[int, int, int]"
-         "__pow__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/ntheory/tests/test_residue.py:218:20 - error: Argument of type "int | None" cannot be assigned to parameter "base" of type "_SupportsPow3[_E_contra@pow, _M_contra@pow, _T_co@pow]" in function "pow"
+   .../projects/sympy/sympy/ntheory/tests/test_residue.py:218:20 - error: Argument of type "int | None" cannot be assigned to parameter "base" of type "int" in function "pow"
-     Type "int | None" is not assignable to type "_SupportsPow3[int, int, int]"
+     Type "int | None" is not assignable to type "int"
+       "None" is not assignable to "int" (reportArgumentType)
-       "None" is incompatible with protocol "_SupportsPow3[int, int, int]"
-         "__pow__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:3570:13 - error: Argument of type "int | None" cannot be assigned to parameter "base" of type "_SupportsPow3[_E_contra@pow, _M_contra@pow, _T_co@pow]" in function "pow"
+   .../projects/sympy/sympy/solvers/diophantine/diophantine.py:3570:13 - error: Argument of type "int | None" cannot be assigned to parameter "base" of type "int" in function "pow"
-     Type "int | None" is not assignable to type "_SupportsPow3[int, int, int]"
+     Type "int | None" is not assignable to type "int"
+       "None" is not assignable to "int" (reportArgumentType)
-       "None" is incompatible with protocol "_SupportsPow3[int, int, int]"
-         "__pow__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:313:18 - error: Argument of type "list[Iterator[Unknown | Any]]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__" (reportArgumentType)
+   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:313:18 - error: Argument of type "list[Iterator[Unknown]]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__" (reportArgumentType)
-   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:313:30 - error: Cannot access attribute "as_independent" for class "Basic"
-     Attribute "as_independent" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:382:18 - error: Argument of type "list[Iterator[Unknown | Any]]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__" (reportArgumentType)
+   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:382:18 - error: Argument of type "list[Iterator[Unknown]]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__" (reportArgumentType)
-   .../projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:382:30 - error: Cannot access attribute "as_independent" for class "Basic"
-     Attribute "as_independent" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/solvers/ode/hypergeometric.py:246:67 - error: Operator "**" not supported for types "Basic" and "Literal[2]" (reportOperatorIssue)
+   .../projects/sympy/sympy/solvers/ode/lie_group.py:618:61 - error: Operator "-" not supported for type "Unknown | Basic" (reportOperatorIssue)
-   .../projects/sympy/sympy/solvers/ode/nonhomogeneous.py:467:28 - error: Argument of type "Unknown | Expr | Any | None" cannot be assigned to parameter "expr" of type "Expr" in function "make_args"
+   .../projects/sympy/sympy/solvers/ode/nonhomogeneous.py:467:28 - error: Argument of type "Unknown | None" cannot be assigned to parameter "expr" of type "Expr" in function "make_args"
-     Type "Unknown | Expr | Any | None" is not assignable to type "Expr"
+     Type "Unknown | None" is not assignable to type "Expr"
-   .../projects/sympy/sympy/solvers/ode/ode.py:1515:38 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1516:38 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1526:9 - error: No overloads for "update" match the provided arguments (reportCallIssue)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1526:12 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1526:19 - error: Argument of type "Unknown | dict[Unknown, Unknown] | None" cannot be assigned to parameter "m" of type "Iterable[tuple[str, Unknown]]" in function "update"
-     Type "Unknown | dict[Unknown, Unknown] | None" is not assignable to type "Iterable[tuple[str, Unknown]]"
-       "None" is incompatible with protocol "Iterable[tuple[str, Unknown]]"
-         "__iter__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1533:43 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1533:64 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1539:9 - error: No overloads for "update" match the provided arguments (reportCallIssue)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1539:12 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1539:19 - error: Argument of type "Unknown | dict[Unknown, Unknown] | None" cannot be assigned to parameter "m" of type "Iterable[tuple[str, Unknown]]" in function "update"
-     Type "Unknown | dict[Unknown, Unknown] | None" is not assignable to type "Iterable[tuple[str, Unknown]]"
-       "None" is incompatible with protocol "Iterable[tuple[str, Unknown]]"
-         "__iter__" is not present (reportArgumentType)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1546:43 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1546:74 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1552:9 - error: No overloads for "update" match the provided arguments (reportCallIssue)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1552:12 - error: "update" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/sympy/sympy/solvers/ode/ode.py:1552:19 - error: Argument of type "Unknown | dict[Unknown, Unknown] | None" cannot be assigned to parameter "m" of type "Iterable[tuple[str, Unknown]]" in function "update"
-     Type "Unknown | dict[Unknown, Unknown] | None" is not assignable to type "Iterable[tuple[str, Unknown]]"
-       "None" is incompatible with protocol "Iterable[tuple[str, Unknown]]"

... (truncated 1315 lines) ...

pip (https://github.com/pypa/pip)
- .../projects/pip/src/pip/_vendor/rich/_ratio.py
-   .../projects/pip/src/pip/_vendor/rich/_ratio.py:69:17 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
-   .../projects/pip/src/pip/_vendor/rich/_ratio.py:69:17 - error: Argument of type "float" cannot be assigned to parameter "value" of type "int | None" in function "__setitem__"
-     Type "float" is not assignable to type "int | None"
-       "float" is not assignable to "int"
-       "float" is not assignable to "None" (reportArgumentType)
- 1109 errors, 27 warnings, 0 informations
+ 1107 errors, 27 warnings, 0 informations

pycryptodome (https://github.com/Legrandin/pycryptodome)
-   .../projects/pycryptodome/lib/Crypto/Math/Primality.py:101:17 - error: Argument of type "IntegerBase | Literal[1]" cannot be assigned to parameter "base" of type "_SupportsPow3[_E_contra@pow, _M_contra@pow, _T_co@pow]" in function "pow"
+   .../projects/pycryptodome/lib/Crypto/Math/Primality.py:101:23 - error: Argument of type "IntegerBase" cannot be assigned to parameter "exp" of type "complex" in function "pow"
+     "IntegerBase" is not assignable to "complex" (reportArgumentType)
+   .../projects/pycryptodome/lib/Crypto/Math/Primality.py:101:26 - error: Argument of type "IntegerBase" cannot be assigned to parameter "mod" of type "None" in function "pow"
+     "IntegerBase" is not assignable to "None" (reportArgumentType)
-     Type "IntegerBase | Literal[1]" is not assignable to type "_SupportsPow3[IntegerBase, IntegerBase, _T_co@pow]"
-       "Literal[1]" is incompatible with protocol "_SupportsPow3[IntegerBase, IntegerBase, _T_co@pow]"
-         "__pow__" is an incompatible type
-           No overloaded function matches type "(other: _E_contra@_SupportsPow3, modulo: _M_contra@_SupportsPow3, /) -> _T_co@_SupportsPow3" (reportArgumentType)
-   .../projects/pycryptodome/lib/Crypto/PublicKey/DSA.py:483:13 - error: Argument of type "IntegerBase | Unknown | Literal[1]" cannot be assigned to parameter "base" of type "_SupportsPow3[_E_contra@pow, _M_contra@pow, _T_co@pow]" in function "pow"
+   .../projects/pycryptodome/lib/Crypto/PublicKey/DSA.py:483:16 - error: Argument of type "IntegerBase" cannot be assigned to parameter "exp" of type "complex" in function "pow"
+     "IntegerBase" is not assignable to "complex" (reportArgumentType)
+   .../projects/pycryptodome/lib/Crypto/PublicKey/DSA.py:483:19 - error: Argument of type "IntegerBase" cannot be assigned to parameter "mod" of type "None" in function "pow"
+     "IntegerBase" is not assignable to "None" (reportArgumentType)
-     Type "IntegerBase | Unknown | Literal[1]" is not assignable to type "_SupportsPow3[IntegerBase, IntegerBase, _T_co@pow]"
-       "Literal[1]" is incompatible with protocol "_SupportsPow3[IntegerBase, IntegerBase, _T_co@pow]"
-         "__pow__" is an incompatible type
-           No overloaded function matches type "(other: _E_contra@_SupportsPow3, modulo: _M_contra@_SupportsPow3, /) -> _T_co@_SupportsPow3" (reportArgumentType)
- 1684 errors, 55 warnings, 0 informations
+ 1686 errors, 55 warnings, 0 informations

static-frame (https://github.com/static-frame/static-frame)
-   .../projects/static-frame/static_frame/core/quilt.py:1183:61 - error: Argument of type "TLabel | NDArray[Any]" cannot be assigned to parameter "label" of type "TLabel" in function "_relabel"
-     Type "TLabel | NDArray[Any]" is not assignable to type "TLabel"
-       Type "NDArray[Any]" is not assignable to type "TLabel"
-         "ndarray[_Shape, dtype[Any]]" is incompatible with protocol "Hashable"
-           "__hash__" is an incompatible type
-           "__hash__" is not defined as a ClassVar in protocol
-             Type "None" is not assignable to type "() -> int"
-         "ndarray[_Shape, dtype[Any]]" is not assignable to "int"
-         "ndarray[_Shape, dtype[Any]]" is not assignable to "integer[Any]"
-     ... (reportArgumentType)
-   .../projects/static-frame/static_frame/core/quilt.py:1193:25 - error: Argument of type "TLabel | NDArray[Any]" cannot be assigned to parameter "label" of type "TLabel" in function "_relabel"
-     Type "TLabel | NDArray[Any]" is not assignable to type "TLabel"
-       Type "NDArray[Any]" is not assignable to type "TLabel"
-         "ndarray[_Shape, dtype[Any]]" is incompatible with protocol "Hashable"
-           "__hash__" is an incompatible type
-           "__hash__" is not defined as a ClassVar in protocol
-             Type "None" is not assignable to type "() -> int"
-         "ndarray[_Shape, dtype[Any]]" is not assignable to "int"
-         "ndarray[_Shape, dtype[Any]]" is not assignable to "integer[Any]"
-     ... (reportArgumentType)
-   .../projects/static-frame/static_frame/core/series.py:3591:16 - error: Type "tuple[tuple[TSingleLabel | NDArray[Any], Any], ...]" is not assignable to return type "Iterable[Tuple[TLabel, Any]]"
-     "tuple[tuple[TSingleLabel | NDArray[Any], Any], ...]" is not assignable to "Iterable[Tuple[TLabel, Any]]"
-       Type parameter "_T_co@Iterable" is covariant, but "tuple[TSingleLabel | NDArray[Any], Any]" is not a subtype of "Tuple[TLabel, Any]"
-         "tuple[TSingleLabel | NDArray[Any], Any]" is not assignable to "Tuple[TLabel, Any]"
-           Tuple entry 1 is incorrect type
-             Type "TSingleLabel | NDArray[Any]" is not assignable to type "TLabel" (reportReturnType)
-   .../projects/static-frame/static_frame/core/type_blocks.py:187:17 - error: Return type of generator function must be compatible with "Generator[tuple[Tuple[Any, ...] | NDArray[Any], ndarray[tuple[int], dtype[numpy.bool[builtins.bool]]], TypeBlocks | TNDArrayAny], Any, Any]"
-     Type "Tuple[Any, ...] | NDArray[Any]" is not assignable to type "TLabel"
-       Type "NDArray[Any]" is not assignable to type "TLabel"
-         "ndarray[_Shape, dtype[Any]]" is incompatible with protocol "Hashable"
-           "__hash__" is an incompatible type
-           "__hash__" is not defined as a ClassVar in protocol
-             Type "None" is not assignable to type "() -> int"
-         "ndarray[_Shape, dtype[Any]]" is not assignable to "int"
-         "ndarray[_Shape, dtype[Any]]" is not assignable to "integer[Any]" (reportReturnType)
-   .../projects/static-frame/static_frame/core/type_blocks.py:196:17 - error: Return type of generator function must be compatible with "Generator[tuple[Tuple[Any, ...] | NDArray[Any], ndarray[tuple[int], dtype[numpy.bool[builtins.bool]]], TypeBlocks | TNDArrayAny], Any, Any]"
-     Type "Tuple[Any, ...] | NDArray[Any]" is not assignable to type "TLabel"
-       Type "NDArray[Any]" is not assignable to type "TLabel"
-         "ndarray[_Shape, dtype[Any]]" is incompatible with protocol "Hashable"
-           "__hash__" is an incompatible type
-           "__hash__" is not defined as a ClassVar in protocol
-             Type "None" is not assignable to type "() -> int"
-         "ndarray[_Shape, dtype[Any]]" is not assignable to "int"
-         "ndarray[_Shape, dtype[Any]]" is not assignable to "integer[Any]" (reportReturnType)
- 80 errors, 71 warnings, 0 informations
+ 75 errors, 71 warnings, 0 informations

rich (https://github.com/Textualize/rich)
- .../projects/rich/rich/_ratio.py
-   .../projects/rich/rich/_ratio.py:69:17 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
-   .../projects/rich/rich/_ratio.py:69:17 - error: Argument of type "float" cannot be assigned to parameter "value" of type "int | None" in function "__setitem__"
-     Type "float" is not assignable to type "int | None"
-       "float" is not assignable to "int"
-       "float" is not assignable to "None" (reportArgumentType)
- 365 errors, 43 warnings, 0 informations
+ 363 errors, 43 warnings, 0 informations

jax (https://github.com/google/jax)
+   .../projects/jax/jax/_src/lax/convolution.py:761:58 - error: Argument of type "_Array[tuple[int, int], signedinteger[_64Bit]] | Unknown" cannot be assigned to parameter "iterable" of type "Iterable[_T1@__new__]" in function "__new__"
+     Type "_Array[tuple[int, int], signedinteger[_64Bit]] | Unknown" is not assignable to type "Iterable[_T1@__new__]"
+       "ndarray[tuple[int, int], dtype[signedinteger[_64Bit]]]" is incompatible with protocol "Iterable[_T1@__new__]"
+         Could not bind method "__iter__" because "ndarray[tuple[int, int], dtype[signedinteger[_64Bit]]]" is not assignable to parameter "self"
+           "ndarray[tuple[int, int], dtype[signedinteger[_64Bit]]]" is not assignable to "ndarray[tuple[int], dtype[object_]]"
+             Type parameter "_ShapeT_co@ndarray" is covariant, but "tuple[int, int]" is not a subtype of "tuple[int]"
+             Type parameter "_DType_co@ndarray" is covariant, but "dtype[signedinteger[_64Bit]]" is not a subtype of "dtype[object_]"
+         Could not bind method "__iter__" because "ndarray[tuple[int, int], dtype[signedinteger[_64Bit]]]" is not assignable to parameter "self"
+           "ndarray[tuple[int, int], dtype[signedinteger[_64Bit]]]" is not assignable to "ndarray[tuple[int], dtype[_SCT@__iter__]]" (reportArgumentType)
- 3835 errors, 53 warnings, 0 informations
+ 3836 errors, 53 warnings, 0 informations

@erictraut erictraut merged commit d97565a into main Aug 30, 2025
16 checks passed
@erictraut erictraut deleted the issue-10849 branch August 30, 2025 22:05
erictraut added a commit that referenced this pull request Sep 1, 2025
* main:
  Changed the evaluated type of `__class__` from `type[Self]` to `type[<Enclosing class]`. This addresses #10685. (#10874)
  Added optimization that reduces the number of Uri objects that need to be created during type evaluation. This is an attempt to address #10832. (#10872)
  Fixed bug that causes a false negative when using unquoted types in a TypedDict functional class definition if the types are forward declared. This addresses #10612. (#10869)
  Fixed bug that resulted in false negative when backslash followed by line feed occurs at end of file. This addresses #10814. (#10867)
  Fixed false negative when a keyword parameter in a child class method overrides a method with a `**kwargs` in the parent and the type is incompatible. This addresses #10815. (#10866)
  Fixed regression introduced in 1.1.343 that results in nondeterministic (order-dependent) type evaluation under certain circumstances involving recursive type aliases. This addresses #10850. (#10865)
  Revert "Added support for tracking multiple constraint sets when performing protocol matching. This allows protocols with overloaded methods to contribute independent constraint sets. This addresses #9835. (#9864)" (#10863)
  Fixed bug that contributes to out-of-memory crashes under certain circumstances where a module's transitive import graph is very large and may not fit within the available heap space. (#10862)
  Bump tmp from 0.2.3 to 0.2.5 in /packages/vscode-pyright (#10824)
  Added support for `match_args` dataclass parameter. This addresses #10858. (#10861)
  Fixed bug that results in false negative when a `closed=False` is used in `TypedDict` that subclasses from a non-open `TypedDict` base class. This addresses #10859. (#10860)
  Revert "Reverted a recent change that appears to have affected performance on some projects. This attempts to address #10832. (#10841)"
  Improved performance of import resolution when there are large number… (#10855)
  Document editable installs with uv (#10854)
  Fixed a bug that results in spurious errors if a class decorator is a… (#10846)
  Fixed a bug that results in false positive errors when using `object` methods (like `__eq__`) on a `Sentinel` instance. This addresses #10773. (#10844)
  Fixed bug that results in incorrect literal math results for bitwise negation. This addresses #10834. (#10842)
  Reverted a recent change that appears to have affected performance on some projects. This attempts to address #10832. (#10841)
  pull-pylance-with-pyright-1.1.403-20250820-201137 (#10831)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant