Skip to content

[ty]: special-case comparisons of Generator prior to Python 3.13#23386

Merged
oconnor663 merged 2 commits intomainfrom
jack/generator
Feb 23, 2026
Merged

[ty]: special-case comparisons of Generator prior to Python 3.13#23386
oconnor663 merged 2 commits intomainfrom
jack/generator

Conversation

@oconnor663
Copy link
Contributor

Fixes astral-sh/ty#2426.

Prior to Python 3.13, the _ReturnT_co type parameter doesn't appear in any Generator methods in
typeshed (except __iter__, which returns the self type recursively and gets normalized to Any).
We need to special-case Generator so that specializations that differ in their return type don't
appear equivalent.

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 18, 2026

Typing conformance results regressed ❌

The percentage of diagnostics emitted that were expected errors decreased from 84.96% to 84.87%. The percentage of expected errors that received a diagnostic held steady at 75.14%.

Summary

Metric Old New Diff Outcome
True Positives 819 819 +0
False Positives 145 146 +1 ⏫ (❌)
False Negatives 271 271 +0
Total Diagnostics 964 965 +1
Precision 84.96% 84.87% -0.09% ⏬ (❌)
Recall 75.14% 75.14% +0.00%

False positives added

Details
Location Name Message
narrowing_typeis.py:35:18 invalid-assignment Object of type object is not assignable to int

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 18, 2026

Memory usage report

Summary

Project Old New Diff Outcome
sphinx 272.07MB 272.07MB -0.00% (2.69kB) ⬇️
flake8 49.45MB 49.45MB -0.01% (4.76kB) ⬇️
trio 121.13MB 121.08MB -0.04% (52.71kB) ⬇️
prefect 714.76MB 714.37MB -0.05% (394.95kB) ⬇️

Significant changes

Click to expand detailed breakdown

sphinx

Name Old New Diff Outcome
CallableType 1.13MB 1.12MB -0.18% (2.11kB) ⬇️
infer_definition_types 24.48MB 24.48MB -0.00% (300.00B) ⬇️
InteriorNode<'db>::or_::interned_arguments 32.19kB 32.11kB -0.24% (80.00B) ⬇️
InteriorNode<'db>::and_::interned_arguments 18.98kB 18.91kB -0.41% (80.00B) ⬇️
InteriorNode<'db>::and_ 17.45kB 17.38kB -0.38% (68.00B) ⬇️
InteriorNode<'db>::or_ 30.25kB 30.19kB -0.22% (68.00B) ⬇️

flake8

Name Old New Diff Outcome
CallableType 182.67kB 179.37kB -1.81% (3.30kB) ⬇️
infer_definition_types 1.89MB 1.89MB -0.05% (900.00B) ⬇️
InteriorNode<'db>::or_::interned_arguments 3.91kB 3.75kB -4.00% (160.00B) ⬇️
InteriorNode<'db>::and_::interned_arguments 1.80kB 1.64kB -8.70% (160.00B) ⬇️
InteriorNode<'db>::and_ 1.55kB 1.42kB -8.56% (136.00B) ⬇️
InteriorNode<'db>::or_ 3.65kB 3.52kB -3.64% (136.00B) ⬇️

trio

Name Old New Diff Outcome
CallableType 610.26kB 595.85kB -2.36% (14.41kB) ⬇️
infer_definition_types 7.63MB 7.62MB -0.12% (9.67kB) ⬇️
infer_expression_types_impl 7.20MB 7.20MB -0.11% (7.76kB) ⬇️
cached_protocol_interface 142.32kB 137.11kB -3.66% (5.21kB) ⬇️
Type<'db>::apply_specialization_ 772.14kB 768.01kB -0.53% (4.12kB) ⬇️
Type<'db>::apply_specialization_::interned_arguments 659.06kB 656.48kB -0.39% (2.58kB) ⬇️
ProtocolInterface 88.47kB 85.94kB -2.86% (2.53kB) ⬇️
FunctionType 1.51MB 1.51MB -0.16% (2.52kB) ⬇️
InteriorNode 43.98kB 41.64kB -5.31% (2.34kB) ⬇️
FunctionType<'db>::signature_ 1.07MB 1.07MB -0.12% (1.37kB) ⬇️
solutions_inner 39.04kB 38.25kB -2.03% (812.00B) ⬇️
InteriorNode<'db>::and_::interned_arguments 7.27kB 6.48kB -10.75% (800.00B) ⬇️
InteriorNode<'db>::or_::interned_arguments 8.44kB 7.73kB -8.33% (720.00B) ⬇️
InteriorNode<'db>::and_ 6.39kB 5.70kB -10.76% (704.00B) ⬇️
is_redundant_with_impl::interned_arguments 567.10kB 567.79kB +0.12% (704.00B) ⬇️
... 15 more

prefect

Name Old New Diff Outcome
infer_expression_types_impl 61.99MB 61.91MB -0.12% (77.74kB) ⬇️
infer_definition_types 88.07MB 88.00MB -0.08% (68.33kB) ⬇️
infer_expression_type_impl 15.43MB 15.37MB -0.39% (61.56kB) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 9.95MB 9.91MB -0.38% (38.67kB) ⬇️
CallableType 1.99MB 1.96MB -1.58% (32.13kB) ⬇️
Type<'db>::member_lookup_with_policy_ 15.26MB 15.24MB -0.16% (25.75kB) ⬇️
InteriorNode 199.98kB 181.29kB -9.34% (18.69kB) ⬇️
cached_protocol_interface 428.60kB 415.03kB -3.17% (13.57kB) ⬇️
Type<'db>::class_member_with_policy_ 16.78MB 16.77MB -0.08% (13.07kB) ⬇️
Type<'db>::apply_specialization_ 3.83MB 3.82MB -0.30% (11.86kB) ⬇️
all_narrowing_constraints_for_expression 5.79MB 5.78MB -0.18% (10.59kB) ⬇️
Type<'db>::apply_specialization_::interned_arguments 2.88MB 2.88MB -0.26% (7.81kB) ⬇️
FunctionType 8.37MB 8.36MB -0.08% (7.25kB) ⬇️
ProtocolInterface 266.73kB 260.12kB -2.48% (6.61kB) ⬇️
is_redundant_with_impl 5.66MB 5.65MB -0.09% (4.93kB) ⬇️
... 26 more

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 18, 2026

mypy_primer results

Changes were detected when running on open source projects
anyio (https://github.com/agronholm/anyio)
+ src/anyio/from_thread.py:274:35: error[invalid-argument-type] Argument to bound method `set_result` is incorrect: Expected `T_Retval@_call_func`, found `object`
- src/anyio/functools.py:375:25: warning[redundant-cast] Value is already of type `T@reduce`
+ src/anyio/functools.py:384:43: error[invalid-argument-type] Argument is incorrect: Expected `T@reduce`, found `object`
- src/anyio/functools.py:384:43: error[invalid-argument-type] Argument is incorrect: Expected `S@reduce`, found `T@reduce`
+ src/anyio/functools.py:384:43: error[invalid-argument-type] Argument is incorrect: Expected `S@reduce`, found `object`
- Found 90 diagnostics
+ Found 91 diagnostics

pip (https://github.com/pypa/pip)
- src/pip/_internal/req/req_uninstall.py:132:42: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Unknown | Sized`
+ src/pip/_internal/req/req_uninstall.py:132:42: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Sized | Unknown`
- src/pip/_internal/req/req_uninstall.py:133:40: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Unknown | Sized`
+ src/pip/_internal/req/req_uninstall.py:133:40: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Sized | Unknown`
- src/pip/_internal/req/req_uninstall.py:139:27: error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | Sized` and `LiteralString`
+ src/pip/_internal/req/req_uninstall.py:139:27: error[unsupported-operator] Operator `+` is not supported between objects of type `Sized | Unknown` and `LiteralString`

spack (https://github.com/spack/spack)
- lib/spack/spack/llnl/util/filesystem.py:1668:35: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Unknown | Sized`
+ lib/spack/spack/llnl/util/filesystem.py:1668:35: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Sized | Unknown`
- lib/spack/spack/llnl/util/filesystem.py:1674:25: error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Unknown | Sized`
+ lib/spack/spack/llnl/util/filesystem.py:1674:25: error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Sized | Unknown`
- lib/spack/spack/vendor/jinja2/async_utils.py:56:22: warning[redundant-cast] Value is already of type `Awaitable[V@auto_await]`
- Found 4387 diagnostics
+ Found 4386 diagnostics

jinja (https://github.com/pallets/jinja)
- src/jinja2/async_utils.py:68:22: warning[redundant-cast] Value is already of type `Awaitable[V@auto_await]`
- Found 182 diagnostics
+ Found 181 diagnostics

aiortc (https://github.com/aiortc/aiortc)
- src/aiortc/sdp.py:446:52: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `None | Unknown | str`
+ src/aiortc/sdp.py:446:52: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `None | str | Unknown`

starlette (https://github.com/encode/starlette)
+ starlette/_exception_handler.py:63:23: error[call-non-callable] Object of type `~None` is not callable
+ starlette/middleware/errors.py:181:23: error[call-non-callable] Object of type `object` is not callable
+ starlette/responses.py:230:13: error[invalid-assignment] Object of type `AsyncIterable[str | bytes | memoryview[int]] | (Iterable[str | bytes | memoryview[int]] & AsyncIterable[object])` is not assignable to attribute `body_iterator` of type `AsyncIterable[str | bytes | memoryview[int]]`
- Found 191 diagnostics
+ Found 194 diagnostics

kopf (https://github.com/nolar/kopf)
- kopf/_kits/webhacks.py:88:42: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `AsyncGenerator[WebhookClientConfig, None]`, found `AsyncGenerator[object, None]`
+ kopf/_kits/webhacks.py:88:42: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `AsyncGenerator[WebhookClientConfig, None]`, found `AsyncIterator[WebhookClientConfig] & AsyncGenerator[object, None]`
- kopf/_kits/webhacks.py:92:42: error[invalid-argument-type] Argument to bound method `remove` is incorrect: Expected `AsyncGenerator[WebhookClientConfig, None]`, found `AsyncGenerator[object, None]`
+ kopf/_kits/webhacks.py:92:42: error[invalid-argument-type] Argument to bound method `remove` is incorrect: Expected `AsyncGenerator[WebhookClientConfig, None]`, found `AsyncIterator[WebhookClientConfig] & AsyncGenerator[object, None]`

graphql-core (https://github.com/graphql-python/graphql-core)
- tests/execution/test_middleware.py:265:20: error[unresolved-attribute] Object of type `object` has no attribute `data`
+ tests/execution/test_middleware.py:121:20: error[unresolved-attribute] Object of type `object` has no attribute `data`
- tests/execution/test_middleware.py:267:20: error[unresolved-attribute] Object of type `object` has no attribute `data`
+ tests/execution/test_middleware.py:222:20: error[unresolved-attribute] Object of type `object` has no attribute `data`
+ tests/execution/test_middleware.py:230:20: error[unresolved-attribute] Object of type `object` has no attribute `data`
- Found 640 diagnostics
+ Found 641 diagnostics

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/core/spidermw.py:209:34: error[invalid-argument-type] Argument to function `process_async` is incorrect: Expected `AsyncIterator[_T@_evaluate_iterable]`, found `(Iterable[_T@_evaluate_iterable] & AsyncIterator[object]) | AsyncIterator[_T@_evaluate_iterable]`
+ scrapy/pipelines/__init__.py:103:20: error[invalid-return-type] Return type does not match returned value: expected `Awaitable[None]`, found `Awaitable[Coroutine[Any, Any, None] | Unknown | None]`
- Found 1777 diagnostics
+ Found 1779 diagnostics

pylint (https://github.com/pycqa/pylint)
- pylint/checkers/refactoring/implicit_booleaness_checker.py:219:24: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `str | Unknown`
+ pylint/checkers/refactoring/implicit_booleaness_checker.py:219:24: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `Unknown | str`
- pylint/checkers/refactoring/implicit_booleaness_checker.py:219:62: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `str | Unknown`
+ pylint/checkers/refactoring/implicit_booleaness_checker.py:219:62: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `Unknown | str`
- pylint/checkers/refactoring/implicit_booleaness_checker.py:222:27: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `str | (Unknown & ~None)`
+ pylint/checkers/refactoring/implicit_booleaness_checker.py:222:27: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `(Unknown & ~None) | str`
- pylint/checkers/refactoring/implicit_booleaness_checker.py:236:29: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `str | Unknown`
+ pylint/checkers/refactoring/implicit_booleaness_checker.py:236:29: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `Unknown | str`
- pylint/checkers/refactoring/implicit_booleaness_checker.py:239:29: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `str | Unknown`
+ pylint/checkers/refactoring/implicit_booleaness_checker.py:239:29: error[unresolved-attribute] Attribute `as_string` is not defined on `str` in union `Unknown | str`

rich (https://github.com/Textualize/rich)
- tests/test_tools.py:17:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, str | Unknown]]`
+ tests/test_tools.py:17:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, Unknown | str]]`
- tests/test_tools.py:18:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, str | Unknown]]`
+ tests/test_tools.py:18:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, Unknown | str]]`
- tests/test_tools.py:19:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, str | Unknown]]`
+ tests/test_tools.py:19:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, Unknown | str]]`
- tests/test_tools.py:20:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, str | Unknown]]`
+ tests/test_tools.py:20:17: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Iterable[tuple[bool, Unknown | str]]`

sockeye (https://github.com/awslabs/sockeye)
- sockeye/output_handler.py:254:80: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Unknown | list[str]]`, found `list[list[str]] | None`
+ sockeye/output_handler.py:254:80: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[list[str] | Unknown]`, found `list[list[str]] | None`

pylox (https://github.com/sco1/pylox)
- pylox/containers/array.py:146:9: error[invalid-assignment] Object of type `deque[Unknown | None]` is not assignable to attribute `fields` of type `dict[Unknown, Unknown]`
+ pylox/containers/array.py:146:9: error[invalid-assignment] Object of type `deque[None | Unknown]` is not assignable to attribute `fields` of type `dict[Unknown, Unknown]`

PyGithub (https://github.com/PyGithub/PyGithub)
- github/Requester.py:899:57: error[invalid-argument-type] Argument to bound method `__hostnameHasDomain` is incorrect: Expected `str | list[str]`, found `Unknown | list[Unknown | str] | list[None | Unknown | str]`
+ github/Requester.py:899:57: error[invalid-argument-type] Argument to bound method `__hostnameHasDomain` is incorrect: Expected `str | list[str]`, found `Unknown | list[Unknown | str] | list[str | Unknown | None]`

artigraph (https://github.com/artigraph/artigraph)
- tests/arti/types/test_types.py:100:51: error[invalid-argument-type] Argument is incorrect: Expected `frozenset[Any]`, found `frozenset[float | Unknown | int] | list[Unknown | int | float] | tuple[float | Unknown | int, ...]`
+ tests/arti/types/test_types.py:100:51: error[invalid-argument-type] Argument is incorrect: Expected `frozenset[Any]`, found `frozenset[float | Unknown | int] | list[int | Unknown | float] | tuple[float | Unknown | int, ...]`

pydantic (https://github.com/pydantic/pydantic)
- pydantic/_internal/_core_metadata.py:87:54: error[invalid-assignment] Invalid assignment to key "pydantic_js_extra" with declared type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | ((dict[str, Divergent], type[Any], /) -> None)` on TypedDict `CoreMetadata`: value of type `dict[object, object]`
+ pydantic/_internal/_core_metadata.py:87:54: error[invalid-assignment] Invalid assignment to key "pydantic_js_extra" with declared type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | ((dict[str, int | float | str | ... omitted 3 union elements], type[Any], /) -> None)` on TypedDict `CoreMetadata`: value of type `dict[object, object]`
- pydantic/fields.py:949:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:949:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:989:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:989:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1032:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:1032:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1072:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:1072:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1115:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:1115:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1154:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:1154:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1194:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`
+ pydantic/fields.py:1194:5: error[invalid-parameter-default] Default value of type `PydanticUndefinedType` is not assignable to annotated parameter type `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`
- pydantic/fields.py:1573:13: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`, found `Top[dict[Unknown, Unknown]] | (((dict[str, Divergent], /) -> None) & ~Top[dict[Unknown, Unknown]]) | None`
+ pydantic/fields.py:1573:13: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, int | float | str | ... omitted 3 union elements] | ((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) | None`, found `Top[dict[Unknown, Unknown]] | (((dict[str, int | float | str | ... omitted 3 union elements], /) -> None) & ~Top[dict[Unknown, Unknown]]) | None`

koda-validate (https://github.com/keithasaurus/koda-validate)
+ koda_validate/_internal.py:265:16: error[invalid-return-type] Return type does not match returned value: expected `(Any, /) -> Awaitable[tuple[Literal[True], A@_wrap_async_validator] | tuple[Literal[False], Invalid]]`, found `bound method Top[_ToTupleValidator[Unknown]]._validate_to_tuple_async(val: Never) -> CoroutineType[object, Never, tuple[Literal[True], object] | tuple[Literal[False], Invalid]]`
- Found 423 diagnostics
+ Found 424 diagnostics

psycopg (https://github.com/psycopg/psycopg)
+ psycopg_pool/psycopg_pool/_acompat.py:185:12: error[invalid-return-type] Return type does not match returned value: expected `T@ensure_async`, found `object`
- Found 657 diagnostics
+ Found 658 diagnostics

discord.py (https://github.com/Rapptz/discord.py)
+ discord/app_commands/checks.py:390:42: error[invalid-assignment] Object of type `Coroutine[Any, Any, Cooldown | None] | Cooldown | None` is not assignable to `Cooldown | None`
+ discord/utils.py:713:16: error[invalid-return-type] Return type does not match returned value: expected `T@maybe_coroutine`, found `object`
- Found 535 diagnostics
+ Found 537 diagnostics

trio (https://github.com/python-trio/trio)
- src/trio/_core/_tests/test_run.py:2440:49: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/trio/_util.py:145:12: error[invalid-return-type] Return type does not match returned value: expected `Coroutine[object, Never, RetT@coroutine_or_error]`, found `Coroutine[object, Never, object]`
+ src/trio/_util.py:145:12: error[invalid-return-type] Return type does not match returned value: expected `Coroutine[object, Never, RetT@coroutine_or_error]`, found `Awaitable[RetT@coroutine_or_error] & Coroutine[object, Never, object]`
- Found 472 diagnostics
+ Found 471 diagnostics

pyodide (https://github.com/pyodide/pyodide)
+ src/py/pyodide/webloop.py:120:31: error[invalid-argument-type] Argument to bound method `set_result` is incorrect: Expected `S@then`, found `~Awaitable[object]`
- Found 934 diagnostics
+ Found 935 diagnostics

cloud-init (https://github.com/canonical/cloud-init)
- tests/unittests/distros/test_user_data_normalize.py:24:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | bool | list[Unknown] | ... omitted 3 union elements`
+ tests/unittests/distros/test_user_data_normalize.py:24:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | dict[Unknown | str, Unknown | str] | str | ... omitted 3 union elements`
- tests/unittests/sources/test_gce.py:71:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | bool | list[Unknown] | ... omitted 3 union elements`
+ tests/unittests/sources/test_gce.py:71:31: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[Unknown, Unknown]`, found `Unknown | dict[Unknown | str, Unknown | str] | str | ... omitted 3 union elements`

openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/catalog/utils/__init__.py:132:17: error[unresolved-attribute] Attribute `search` is not defined on `str` in union `str | Unknown`
+ openlibrary/catalog/utils/__init__.py:132:17: error[unresolved-attribute] Attribute `search` is not defined on `str` in union `Unknown | str`

meson (https://github.com/mesonbuild/meson)
+ mesonbuild/mtest.py:1387:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[Awaitable[str] | None, Awaitable[str] | None]`, found `tuple[Task[None] | None, Task[None] | None]`
- Found 2206 diagnostics
+ Found 2207 diagnostics

strawberry (https://github.com/strawberry-graphql/strawberry)
- strawberry/relay/types.py:834:37: error[invalid-argument-type] Argument is incorrect: Expected `_T@aclosing`, found `AsyncIterable[NodeType@ListConnection]`
+ strawberry/relay/types.py:834:37: error[invalid-argument-type] Argument is incorrect: Expected `_T@aclosing`, found `AsyncIterable[NodeType@ListConnection] | AsyncIterator[Unknown]`
+ strawberry/schema/schema.py:772:89: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ strawberry/utils/await_maybe.py:13:16: error[invalid-return-type] Return type does not match returned value: expected `T@await_maybe`, found `object`
- Found 326 diagnostics
+ Found 328 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/_internal/concurrency/api.py:146:20: error[invalid-return-type] Return type does not match returned value: expected `T@wait_for_call_in_loop_thread`, found `Awaitable[T@wait_for_call_in_loop_thread] | T@wait_for_call_in_loop_thread`
+ src/prefect/_internal/concurrency/api.py:198:20: error[invalid-return-type] Return type does not match returned value: expected `T@wait_for_call_in_loop_thread`, found `Awaitable[T@wait_for_call_in_loop_thread] | T@wait_for_call_in_loop_thread`
+ src/prefect/_internal/concurrency/calls.py:350:24: error[invalid-return-type] Return type does not match returned value: expected `Awaitable[None] | None`, found `Task[_T@create_task]`
+ src/prefect/_internal/concurrency/calls.py:409:24: error[invalid-return-type] Return type does not match returned value: expected `Awaitable[T@Call] | None`, found `(T@Call & Awaitable[object]) | Awaitable[T@Call]`
+ src/prefect/cli/_cyclopts/deployment.py:172:49: error[unresolved-attribute] Object of type `object` has no attribute `model_dump`
+ src/prefect/cli/deploy/_core.py:395:47: error[invalid-argument-type] Argument to function `_create_deployment_triggers` is incorrect: Expected `UUID`, found `object`
+ src/prefect/cli/deploy/_core.py:405:44: error[invalid-argument-type] Argument to function `_initialize_deployment_slas` is incorrect: Expected `UUID`, found `object`
+ src/prefect/cli/deploy/_core.py:406:36: error[invalid-argument-type] Argument to function `_create_slas` is incorrect: Expected `UUID`, found `object`
+ src/prefect/cli/deployment.py:292:49: error[unresolved-attribute] Object of type `object` has no attribute `model_dump`
+ src/prefect/concurrency/_leases.py:89:53: error[invalid-argument-type] Argument to bound method `add_done_callback` is incorrect: Expected `(Future[CoroutineType[Any, Any, None] | None], /) -> object`, found `def handle_lease_renewal_failure(future: Future[None]) -> Unknown`
- src/prefect/deployments/runner.py:1017:70: error[unresolved-attribute] Attribute `__name__` is not defined on `((...) -> Any) & ((*args: object, **kwargs: object) -> object)` in union `Unknown | (((...) -> Any) & ((*args: object, **kwargs: object) -> object))`
+ src/prefect/deployments/runner.py:1017:70: error[unresolved-attribute] Attribute `__name__` is not defined on `(...) -> Any` in union `Unknown | ((...) -> Any)`
+ src/prefect/flow_engine.py:1004:32: error[invalid-await] `Unknown | R@FlowRunEngine | Coroutine[Any, Any, R@FlowRunEngine]` is not awaitable
+ src/prefect/flow_engine.py:1610:24: error[invalid-await] `Unknown | R@AsyncFlowRunEngine | Coroutine[Any, Any, R@AsyncFlowRunEngine]` is not awaitable
- src/prefect/flows.py:286:34: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
+ src/prefect/flows.py:286:34: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
- src/prefect/flows.py:404:68: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
+ src/prefect/flows.py:404:68: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
- src/prefect/futures.py:318:16: error[invalid-return-type] Return type does not match returned value: expected `R@PrefectDistributedFuture`, found `R@PrefectDistributedFuture | Exception`
+ src/prefect/futures.py:318:16: error[invalid-return-type] Return type does not match returned value: expected `R@PrefectDistributedFuture`, found `R@PrefectDistributedFuture | Exception | Any`
- Found 5914 diagnostics
+ Found 5926 diagnostics

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/build/wheel.py:99:20: error[no-matching-overload] No overload of bound method `__init__` matches arguments
- Found 52 diagnostics
+ Found 51 diagnostics

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/debugging/_redaction.py:16:5: error[unsupported-operator] Operator `|` is not supported between objects of type `frozenset[Unknown | str]` and `Unknown | EnvVariable[set[Unknown]]`
+ ddtrace/debugging/_redaction.py:16:5: error[unsupported-operator] Operator `|` is not supported between objects of type `frozenset[str | Unknown]` and `Unknown | EnvVariable[set[Unknown]]`
- setup.py:1280:5: error[invalid-argument-type] Argument to function `setup` is incorrect: Expected `_MutableDictLike[str, type[Command]]`, found `dict[Unknown | str, Unknown | <class 'CustomBuildExt'> | <class 'LibraryDownloader'> | ... omitted 3 union elements]`
+ setup.py:1280:5: error[invalid-argument-type] Argument to function `setup` is incorrect: Expected `_MutableDictLike[str, type[Command]]`, found `dict[str, <class 'CustomBuildExt'> | <class 'LibraryDownloader'> | <class 'CustomBuildRust'> | <class 'CleanLibraries'> | <class 'ExtensionHashes'>]`
- tests/tracer/test_span.py:193:29: error[invalid-argument-type] Argument to bound method `set_metric` is incorrect: Expected `int | float`, found `str | Unknown | None | ... omitted 6 union elements`
+ tests/tracer/test_span.py:193:29: error[invalid-argument-type] Argument to bound method `set_metric` is incorrect: Expected `int | float`, found `int | Unknown | None | ... omitted 6 union elements`

aiohttp (https://github.com/aio-libs/aiohttp)
- aiohttp/web.py:295:15: error[invalid-assignment] Object of type `object` is not assignable to `Application | Awaitable[Application]`
- Found 195 diagnostics
+ Found 194 diagnostics

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/server/views/session_handler.py:83:5: error[invalid-argument-type] Argument to function `authenticated` is incorrect: Expected `(...) -> Awaitable[None] | None`, found `def get_session(self) -> CoroutineType[Any, Any, ServerSession]`
- Found 851 diagnostics
+ Found 852 diagnostics

materialize (https://github.com/MaterializeInc/materialize)
- misc/python/materialize/cli/mz_workload_anonymize.py:251:13: error[no-matching-overload] No overload of bound method `join` matches arguments
- Found 526 diagnostics
+ Found 525 diagnostics

jax (https://github.com/google/jax)
- jax/_src/export/_export.py:1378:45: error[invalid-argument-type] Argument to function `_get_named_sharding` is incorrect: Expected `ShapedArray`, found `AbstractValue | Unknown`
+ jax/_src/export/_export.py:1378:45: error[invalid-argument-type] Argument to function `_get_named_sharding` is incorrect: Expected `ShapedArray`, found `Unknown | AbstractValue`
- jax/_src/pallas/hlo_interpreter.py:433:37: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `int | DynamicGridDim | Unknown`
+ jax/_src/pallas/hlo_interpreter.py:433:37: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `DynamicGridDim | Unknown | int`
- jax/_src/pallas/mosaic/interpret/interpret_pallas_call.py:1900:37: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `int | DynamicGridDim | Unknown`
+ jax/_src/pallas/mosaic/interpret/interpret_pallas_call.py:1900:37: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `DynamicGridDim | Unknown | int`
- jax/_src/pallas/pallas_call.py:864:37: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `int | DynamicGridDim | Unknown`
+ jax/_src/pallas/pallas_call.py:864:37: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `DynamicGridDim | Unknown | int`

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/datasets/_lfw.py:469:60: error[invalid-argument-type] Argument to class `str` is incorrect: Expected `bytes | bytearray`, found `Unknown | str`
+ sklearn/datasets/_lfw.py:469:60: error[invalid-argument-type] Argument to class `str` is incorrect: Expected `bytes | bytearray`, found `str | Unknown`
- sklearn/externals/array_api_compat/common/_linalg.py:113:15: error[unresolved-attribute] Attribute `max` is not defined on `tuple[Any, ...]` in union `tuple[Any, ...] | Any`
+ sklearn/externals/array_api_compat/common/_linalg.py:113:15: error[unresolved-attribute] Attribute `max` is not defined on `tuple[Any, ...]` in union `Any | tuple[Any, ...]`
- sklearn/externals/array_api_compat/common/_linalg.py:113:76: error[unresolved-attribute] Attribute `dtype` is not defined on `tuple[Any, ...]` in union `tuple[Any, ...] | Any`
+ sklearn/externals/array_api_compat/common/_linalg.py:113:76: error[unresolved-attribute] Attribute `dtype` is not defined on `tuple[Any, ...]` in union `Any | tuple[Any, ...]`
- sklearn/externals/array_api_compat/common/_linalg.py:117:15: error[unresolved-attribute] Attribute `max` is not defined on `tuple[Any, ...]` in union `tuple[Any, ...] | Any`
+ sklearn/externals/array_api_compat/common/_linalg.py:117:15: error[unresolved-attribute] Attribute `max` is not defined on `tuple[Any, ...]` in union `Any | tuple[Any, ...]`

static-frame (https://github.com/static-frame/static-frame)
- static_frame/test/unit/test_frame_iter.py:1389:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1389:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1397:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1397:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1408:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1408:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1411:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1411:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1431:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1431:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1439:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1439:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1481:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1481:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1489:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1489:13: error[unresolved-attribute] Attribute `to_pairs` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1549:26: error[unresolved-attribute] Attribute `tolist` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1549:26: error[unresolved-attribute] Attribute `tolist` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1550:26: error[unresolved-attribute] Attribute `tolist` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1550:26: error[unresolved-attribute] Attribute `tolist` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1553:26: error[unresolved-attribute] Attribute `tolist` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1553:26: error[unresolved-attribute] Attribute `tolist` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1554:26: error[unresolved-attribute] Attribute `tolist` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1554:26: error[unresolved-attribute] Attribute `tolist` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
- static_frame/test/unit/test_frame_iter.py:1684:29: error[unresolved-attribute] Attribute `shape` is not defined on `tuple[Any, Any]` in union `tuple[Any, Any] | Any`
+ static_frame/test/unit/test_frame_iter.py:1684:29: error[unresolved-attribute] Attribute `shape` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`

sympy (https://github.com/sympy/sympy)
- sympy/algebras/tests/test_quaternion.py:422:33: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/codegen/tests/test_matrix_nodes.py:27:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/eigen.py:1202:37: error[unresolved-attribute] Object of type `T2'return@call_highest_priority | T1'return@call_highest_priority` has no attribute `pow`
- sympy/matrices/expressions/tests/test_blockmatrix.py:235:13: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:235:33: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:235:53: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_blockmatrix.py:459:12: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/expressions/tests/test_derivatives.py:551:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matadd.py:36:12: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr`
- sympy/matrices/expressions/tests/test_matpow.py:124:47: error[unsupported-operator] Operator `+` is not supported between two objects of type `ImmutableDenseMatrix`
- sympy/matrices/inverse.py:385:11: error[unsupported-operator] Operator `-` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr | Unknown`
- sympy/matrices/inverse.py:393:11: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase` and `MatrixBase | Expr | Unknown`
- sympy/matrices/matrixbase.py:979:18: error[unsupported-operator] Operator `+` is not supported between two objects of type `Self@_eval_wilkinson`
- sympy/matrices/matrixbase.py:2957:16: error[invalid-return-type] Return type does not match returned value: expected `Self@_eval_pow_by_cayley`, found `Self@_eval_pow_by_cayley | T2'return@call_highest_priority | T1'return@call_highest_priority | Unknown`
- sympy/matrices/matrixbase.py:3256:16: error[invalid-return-type] Return type does not match returned value: expected `MatrixBase`, found `T2'return@call_highest_priority | T1'return@call_highest_priority`
- sympy/matrices/matrixbase.py:3256:29: error[invalid-argument-type] Argument is incorrect: Expected `T2'return@call_highest_priority | T1'return@call_highest_priority`, found `MatrixBase`
- sympy/matrices/matrixbase.py:3310:16: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase`
- sympy/matrices/matrixbase.py:3314:16: error[invalid-return-type] Return type does not match returned value: expected `Tmat@__sub__`, found `MatrixBase`
- sympy/matrices/matrixbase.py:4386:16: error[unsupported-operator] Operator `+` is not supported between two objects of type `Self@add`
- sympy/matrices/matrixbase.py:4923:16: error[invalid-return-type] Return type does not match returned value: expected `Self@analytic_func`, found `Self@analytic_func | T2'return@call_highest_priority | T1'return@call_highest_priority | Unknown`
- sympy/matrices/repmatrix.py:321:17: error[unsupported-operator] Operator `-` is not supported between two objects of type `Self@_eval_is_symmetric`
- sympy/matrices/solvers.py:741:12: error[invalid-return-type] Return type does not match returned value: expected `Tmat@_pinv_solve`, found `T2'return@call_highest_priority | T1'return@call_highest_priority`
- sympy/matrices/tests/test_commonmatrix.py:1249:31: error[unsupported-operator] Operator `+` is not supported between objects of type `MutableDenseMatrix` and `ImmutableDenseNDimArray`
- sympy/matrices/tests/test_eigen.py:406:20: error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Iterable[Unknown]`, found `MatrixBase | Unknown`
- sympy/matrices/tests/test_immutable.py:105:23: error[unsupported-operator] Operator `+` is not supported between two objects of type `ImmutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:121:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:123:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:141:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2179:22: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2207:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2908:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2921:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2936:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2937:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:2948:14: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:3471:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrices.py:3478:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_matrices.py:3479:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_matrixbase.py:491:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:493:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:544:12: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:823:31: error[unsupported-operator] Operator `+` is not supported between objects of type `MutableDenseMatrix` and `ImmutableDenseNDimArray`
- sympy/matrices/tests/test_matrixbase.py:876:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:878:32: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:900:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:2931:22: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:2959:26: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3610:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3624:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3639:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3640:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_matrixbase.py:3652:14: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_reductions.py:377:21: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_reductions.py:384:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_reductions.py:385:12: error[unresolved-attribute] Attribute `rank` is not defined on `MatrixExpr` in union `MatrixBase | MatrixExpr | Unknown`
- sympy/matrices/tests/test_solvers.py:68:13: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/matrices/tests/test_sparse.py:573:12: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableSparseMatrix`
- sympy/matrices/tests/test_sparse.py:577:52: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableSparseMatrix`
- sympy/matrices/tests/test_sparse.py:593:17: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableSparseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:13:6: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:16:38: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:16:84: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:16:131: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:21:44: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:21:90: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:21:137: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:25:37: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:25:83: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/parsing/autolev/test-examples/ruletest5.py:25:130: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/control/tests/test_lti.py:3777:31: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/control/tests/test_lti.py:3777:38: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/mechanics/lagrange.py:222:23: error[unsupported-operator] Operator `-` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/lagrange.py:346:17: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/linearize.py:217:28: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/linearize.py:229:29: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/linearize.py:241:29: error[unsupported-operator] Operator `+` is not supported between two objects of type `Unknown | MutableDenseMatrix`
- sympy/physics/mechanics/tests/test_jointsmethod.py:247:17: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/mechanics/tests/test_jointsmethod.py:249:17: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- sympy/physics/quantum/tests/test_represent.py:89:17: error[unsupported-operator] Operator `+` is not supported between objects of type `MatrixBase | Expr` and `MatrixBase`
- sympy/physics/quantum/tests/test_represent.py:91:24: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/physics/quantum/tests/test_represent.py:93:28: error[unsupported-operator] Operator `+` is not supported between two objects of type `MatrixBase | Expr`
- sympy/physics/vector/functions.py:380:21: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Iterable[Unknown]`, found `MatrixBase | Unknown`
- sympy/simplify/cse_main.py:299:23: error[not-iterable] Object of type `Unknown | Sized` may not be iterable
+ sympy/simplify/cse_main.py:299:23: error[not-iterable] Object of type `Sized | Unknown` may not be iterable
- sympy/simplify/cse_main.py:305:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | Sized`
+ sympy/simplify/cse_main.py:305:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Sized | Unknown`
- sympy/solvers/tests/test_numeric.py:137:11: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/solvers/tests/test_pde.py:108:16: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(Unknown | str, /) -> Unknown`, found `<class 'Function'>`
+ sympy/solvers/tests/test_pde.py:108:16: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(str | Unknown, /) -> Unknown`, found `<class 'Function'>`
- sympy/solvers/tests/test_pde.py:129:22: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(Unknown | str, /) -> Unknown`, found `<class 'Function'>`
+ sympy/solvers/tests/test_pde.py:129:22: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(str | Unknown, /) -> Unknown`, found `<class 'Function'>`
- sympy/solvers/tests/test_pde.py:137:16: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(Unknown | str, /) -> Unknown`, found `<class 'Function'>`
+ sympy/solvers/tests/test_pde.py:137:16: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(str | Unknown, /) -> Unknown`, found `<class 'Function'>`
- sympy/solvers/tests/test_pde.py:163:16: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(Unknown | str, /) -> Unknown`, found `<class 'Function'>`
+ sympy/solvers/tests/test_pde.py:163:16: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(str | Unknown, /) -> Unknown`, found `<class 'Function'>`
- sympy/solvers/tests/test_pde.py:201:16: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(Unknown | str, /) -> Unknown`, found `<class 'Function'>`
+ sympy/solvers/tests/test_pde.py:201:16: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(str | Unknown, /) -> Unknown`, found `<class 'Function'>`
- sympy/solvers/tests/test_pde.py:215:16: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(Unknown | str, /) -> Unknown`, found `<class 'Function'>`
+ sympy/solvers/tests/test_pde.py:215:16: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(str | Unknown, /) -> Unknown`, found `<class 'Function'>`
- sympy/solvers/tests/test_solvers.py:722:19: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/solvers/tests/test_solvers.py:723:19: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/solvers/tests/test_solvers.py:724:19: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/solvers/tests/test_solvers.py:724:30: error[unsupported-operator] Operator `-` is not supported between two objects of type `MatrixBase | Expr`
- sympy/stats/tests/test_symbolic_multivariate.py:84:36: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/stats/tests/test_symbolic_multivariate.py:84:84: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/stats/tests/test_symbolic_multivariate.py:85:36: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/tensor/tests/test_tensor.py:1693:19: error[unsupported-operator] Operator `+` is not supported between two objects of type `MutableDenseMatrix`
- sympy/tensor/tests/test_tensor.py:1694:23: error[unsupported-operator] Operator `-` is not supported between two objects of type `MutableDenseMatrix`
- Found 16114 diagnostics
+ Found 16022 diagnostics

rotki (https://github.com/rotki/rotki)
- rotkehlchen/tests/unit/test_makerdao.py:170:9: error[invalid-argument-type] Argument is incorrect: Expected `defaultdict[Asset, defaultdict[str, Balance]]`, found `defaultdict[Asset | Unknown, defaultdict[str, Balance] | Balance | Unknown | dict[Unknown | str, Unknown | Balance]]`
+ rotkehlchen/tests/unit/test_makerdao.py:170:9: error[invalid-argument-type] Argument is incorrect: Expected `defaultdict[Asset, defaultdict[str, Balance]]`, found `defaultdict[Asset | Unknown, defaultdict[str, Balance] | Balance | dict[Unknown | str, Unknown | Balance] | Unknown]`
- rotkehlchen/tests/unit/test_makerdao.py:171:9: error[invalid-argument-type] Argument is incorrect: Expected `defaultdict[Asset, defaultdict[str, Balance]]`, found `defaultdict[Asset | Unknown, defaultdict[str, Balance] | Balance | Unknown | dict[Unknown | str, Unknown | Balance]]`
+ rotkehlchen/tests/unit/test_makerdao.py:171:9: error[invalid-argument-type] Argument is incorrect: Expected `defaultdict[Asset, defaultdict[str, Balance]]`, found `defaultdict[Asset | Unknown, defaultdict[str, Balance] | Balance | dict[Unknown | str, Unknown | Balance] | Unknown]`

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
- tests/indexes/str/test_add.py:27:14: error[unsupported-operator] Operator `+` is not supported between objects of type `Index[Unknown | str]` and `Literal[4]`
+ tests/indexes/str/test_add.py:27:14: error[unsupported-operator] Operator `+` is not supported between objects of type `Index[str | Unknown]` and `Literal[4]`
- tests/indexes/str/test_add.py:28:23: error[unsupported-operator] Operator `+` is not supported between objects of type `Index[Unknown | str]` and `Literal["right"]`
+ tests/indexes/str/test_add.py:28:23: error[unsupported-operator] Operator `+` is not supported between objects of type `Index[str | Unknown]` and `Literal["right"]`
- tests/indexes/str/test_add.py:31:14: error[unsupported-operator] Operator `+` is not supported between objects of type `Literal[4]` and `Index[Unknown | str]`
+ tests/indexes/str/test_add.py:31:14: error[unsupported-operator] Operator `+` is not supported between objects of type `Literal[4]` and `Index[str | Unknown]`
- tests/indexes/str/test_add.py:42:14: error[unsupported-operator] Operator `+` is not supported between objects of type `Index[Unknown | str]` and `list[Unknown | int]`
+ tests/indexes/str/test_add.py:42:14: error[unsupported-operator] Operator `+` is not supported between objects of type `Index[str | Unknown]` and `list[Unknown | int]`
- tests/indexes/str/test_add.py:43:23: error[unsupported-operator] Operator `+` is not supported between objects of type `Index[Unknown | str]` and `list[Unknown | str]`
+ tests/indexes/str/test_add.py:43:23: error[unsupported-operator] Operator `+` is not supported between objects of type `Index[str | Unknown]` and `list[Unknown | str]`
- tests/indexes/str/test_add.py:44:23: error[unsupported-operator] Operator `+` is not supported between objects of type `Index[Unknown | str]` and `tuple[Unknown | str, ...]`
+ tests/indexes/str/test_add.py:44:23: error[unsupported-operator] Operator `+` is not supported between objects of type `Index[str | Unknown]` and `tuple[Unknown | str, ...]`
- tests/indexes/str/test_add.py:47:14: error[unsupported-operator] Operator `+` is not supported between objects of type `list[Unknown | int]` and `Index[Unknown | str]`
+ tests/indexes/str/test_add.py:47:14: error[unsupported-operator] Operator `+` is not supported between objects of type `list[Unknown | int]` and `Index[str | Unknown]`
- tests/indexes/str/test_add.py:48:23: error[unsupported-operator] Operator `+` is not supported between objects of type `list[Unknown | str]` and `Index[Unknown | str]`
+ tests/indexes/str/test_add.py:48:23: error[unsupported-operator] Operator `+` is not supported between objects of type `list[Unknown | str]` and `Index[str | Unknown]`
- tests/indexes/str/test_add.py:49:11: error[type-assertion-failure] Type `Index[Unknown | str]` does not match asserted type `Index[str]`
+ tests/indexes/str/test_add.py:49:11: error[type-assertion-failure] Type `Index[str | Unknown]` does not match asserted type `Index[str]`
- tests/indexes/str/test_mul.py:31:18: error[type-assertion-failure] Type `Index[Unknown | str]` does not match asserted type `Index[str]`
+ tests/indexes/str/test_mul.py:31:18: error[type-assertion-failure] Type `Index[str | Unknown]` does not match asserted type `Index[str]`
- tests/indexes/test_indexes.py:304:9: error[type-assertion-failure] Type `Index[Unknown | str]` does not match asserted type `Index[str]`
+ tests/indexes/test_indexes.py:304:9: error[type-assertion-failure] Type `Index[str | Unknown]` does not match asserted type `Index[str]`
- tests/indexes/test_indexes.py:311:9: error[type-assertion-failure] Type `Index[Unknown | str]` does not match asserted type `Index[str]`
+ tests/indexes/test_indexes.py:311:9: error[type-assertion-failure] Type `Index[str | Unknown]` does not match asserted type `Index[str]`
- tests/indexes/test_indexes.py:1027:11: error[type-assertion-failure] Type `Index[Unknown | str]` does not match asserted type `Index[str]`
+ tests/indexes/test_indexes.py:1027:11: error[type-assertion-failure] Type `Index[str | Unknown]` does not match asserted type `Index[str]`
- tests/indexes/test_indexes.py:1028:11: error[type-assertion-failure] Type `Unknown | str` does not match asserted type `str`
+ tests/indexes/test_indexes.py:1028:11: error[type-assertion-failure] Type `str | Unknown` does not match asserted type `str`
- tests/indexes/test_indexes.py:1029:11: error[type-assertion-failure] Type `Index[Unknown | str]` does not match asserted type `Index[str]`
+ tests/indexes/test_indexes.py:1029:11: error[type-assertion-failure] Type `Index[str | Unknown]` does not match asserted type `Index[str]`
- tests/indexes/test_indexes.py:1335:9: error[type-assertion-failure] Type `Index[Unknown | str]` does not match asserted type `Index[str]`
+ tests/indexes/test_indexes.py:1335:9: error[type-assertion-failure] Type `Index[str | Unknown]` does not match asserted type `Index[str]`
- tests/indexes/test_indexes.py:1532:11: error[type-assertion-failure] Type `Series[Unknown | str]` does not match asserted type `Series[str]`
+ tests/indexes/test_indexes.py:1532:11: error[type-assertion-failure] Type `Series[str | Unknown]` does not match asserted type `Series[str]`
- tests/test_string_accessors.py:29:11: error[type-assertion-failure] Type `Index[Unknown | str]` does not match asserted type `Index[str]`
+ tests/test_string_accessors.py:29:11: error[type-assertion-failure] Type `Index[str | Unknown]` does not match asserted type `Index[str]`

@oconnor663
Copy link
Contributor Author

(I need to look through these conformance/ecosystem results tomorrow. Putting this in draft until then.)

@oconnor663 oconnor663 marked this pull request as draft February 18, 2026 03:36
@ntBre ntBre added the ty Multi-file analysis & type inference label Feb 18, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 18, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-return-type 13 0 2
invalid-argument-type 9 1 4
unresolved-attribute 5 2 0
invalid-assignment 2 1 0
redundant-cast 0 3 0
call-non-callable 2 0 0
unused-type-ignore-comment 1 1 0
Total 32 8 6

Full report with detailed diff (timing results)

@oconnor663
Copy link
Contributor Author

Ok, after a long discussion with @carljm, I now understand the "false positive" above. If you run ty check before and after this PR, you'll see that that diagnostic does appear in both cases. But that's because what this PR is doing is bringing our behavior for Python <=3.12 in line with our behavior for Python >=3.13, and our conformance testing targets 3.12. So it's both a false positive (from the perspective of the conformance suite at least) and a desirable result (because our output is more consistent after this PR compared to before).

@oconnor663
Copy link
Contributor Author

We had a question about whether #23428 (die-normalization) might be an alternative for fixing the new test cases here, but having tried it just now, the new cases fail there the same way they do on main.

@oconnor663 oconnor663 marked this pull request as ready for review February 20, 2026 15:09
@oconnor663
Copy link
Contributor Author

(meant to take this out of Draft yesterday but just forgot to hit the button)

Copy link
Contributor

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

// methods (except `__iter__`, but that returns the self type recursively, which gets
// normalized to `Any`). We don't want generators with different return types to be
// assignable to each other. In this case we use the result of the nominal check above.
if Program::get(db).python_version(db) < PythonVersion::PY313
Copy link
Contributor

@sharkdp sharkdp Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seem to remember that these Program::get(db).python_version(db) are somewhat expensive? If so, should we consider testing the Python version further down in this && chain?

I could easily be wrong here with that assumption though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they can be surprisingly expensive I think, yes

@oconnor663 oconnor663 merged commit 1e33c4e into main Feb 23, 2026
77 of 78 checks passed
@oconnor663 oconnor663 deleted the jack/generator branch February 23, 2026 19:18
## The `Generator` protocol's `_ReturnT_co` needs special casing prior to Python 3.13

Prior to Python 3.13, the `_ReturnT_co` type parameter doesn't appear in any `Generator` methods in
typeshed (except `__iter__`, which returns the self type recursively and gets normalized to `Any`).
Copy link
Contributor

@carljm carljm Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I'm slow getting to this -- would prefer to document a bit more thoroughly our understanding here. The need for special-casing here is not just due to Any normalization as an implementation limitation (which is what I thought when you first identified normalization as the culprit). It is in fact correct (given the information present in typeshed) to consider two pre-3.13 Generator types with different _ReturnT_co as equivalent types -- comparing their __iter__ return type is just a recursive comparison, and we should inductively assume "true" there. So our protocol comparison is working correctly here -- this really is a necessary special case due to the "invisible" use of _ReturnT_co also in StopIteration (which is not visible in the type annotations of Generator.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +187 to +188
// methods (except `__iter__`, but that returns the self type recursively, which gets
// normalized to `Any`). We don't want generators with different return types to be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here -- I feel like "which gets normalized to Any" suggests that it's just an implementation limitation (because Any normalization of recursive types is not always correct, and is a current implementation limitation), but in this case even if we didn't normalize to Any we would still correctly consider the types equivalent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ty thinks Generator[None, None, A] and Generator[None, None, B] are equivalent types on Python <3.13

5 participants