Skip to content

[ty] Sync vendored typeshed stubs#24646

Merged
AlexWaygood merged 6 commits intomainfrom
typeshedbot/sync-typeshed
Apr 15, 2026
Merged

[ty] Sync vendored typeshed stubs#24646
AlexWaygood merged 6 commits intomainfrom
typeshedbot/sync-typeshed

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Close and reopen this PR to trigger CI

@github-actions github-actions bot added the ty Multi-file analysis & type inference label Apr 15, 2026
@sharkdp sharkdp closed this Apr 15, 2026
@sharkdp sharkdp reopened this Apr 15, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Apr 15, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 87.94%. The percentage of expected errors that received a diagnostic held steady at 83.36%. The number of fully passing files held steady at 79/133.

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Apr 15, 2026

Memory usage report

Summary

Project Old New Diff Outcome
prefect 709.06MB 709.15MB +0.01% (100.52kB)
trio 117.49MB 117.56MB +0.06% (70.80kB)
flake8 47.89MB 47.91MB +0.05% (24.59kB)
sphinx 262.60MB 262.57MB -0.01% (30.85kB) ⬇️

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
parsed_module 34.27MB 34.30MB +0.09% (31.30kB)
semantic_index 172.89MB 172.91MB +0.01% (23.64kB)
infer_expression_types_impl 62.00MB 61.99MB -0.02% (10.97kB)
FunctionType 8.78MB 8.78MB +0.08% (6.88kB)
Definition 20.81MB 20.82MB +0.02% (4.73kB)
FunctionType<'db>::signature_ 4.02MB 4.03MB +0.11% (4.69kB)
StaticClassLiteral<'db>::try_mro_ 4.75MB 4.76MB +0.09% (4.54kB)
infer_deferred_types 14.46MB 14.46MB +0.03% (4.06kB)
CallableType 2.12MB 2.12MB +0.16% (3.38kB)
source_text 23.43MB 23.43MB +0.01% (3.33kB)
infer_scope_types_impl 54.23MB 54.23MB +0.01% (3.18kB)
cached_protocol_interface 412.61kB 415.28kB +0.65% (2.67kB)
Specialization 2.25MB 2.25MB +0.11% (2.50kB)
infer_expression_type_impl 13.11MB 13.11MB -0.02% (2.29kB)
infer_definition_types 89.79MB 89.79MB +0.00% (2.19kB)
... 60 more

trio

Name Old New Diff Outcome
parsed_module 27.10MB 27.13MB +0.12% (32.66kB)
semantic_index 29.98MB 30.00MB +0.08% (23.64kB)
Definition 4.00MB 4.00MB +0.12% (4.73kB)
source_text 3.75MB 3.76MB +0.09% (3.31kB)
Type<'db>::apply_specialization_::interned_arguments 645.16kB 642.89kB -0.35% (2.27kB)
Type<'db>::apply_specialization_ 720.46kB 718.34kB -0.29% (2.12kB)
infer_expression_types_impl 7.03MB 7.03MB -0.03% (1.92kB)
StaticClassLiteral<'db>::try_mro_ 820.49kB 822.38kB +0.23% (1.89kB)
StaticClassLiteral<'db>::implicit_attribute_inner_ 746.18kB 747.74kB +0.21% (1.56kB)
infer_expression_type_impl 1.31MB 1.31MB +0.08% (1.07kB)
StaticClassLiteral<'db>::implicit_attribute_inner_::interned_arguments 602.25kB 603.19kB +0.16% (960.00B)
Type<'db>::member_lookup_with_policy_ 1.95MB 1.95MB +0.05% (960.00B)
CallableType 586.21kB 587.06kB +0.14% (864.00B)
FunctionType 1.49MB 1.49MB +0.05% (736.00B)
code_generator_of_static_class 211.96kB 212.65kB +0.32% (704.00B)
... 40 more

flake8

Name Old New Diff Outcome
parsed_module 17.37MB 17.40MB +0.13% (23.58kB)
semantic_index 13.71MB 13.73MB +0.10% (13.78kB)
infer_expression_types_impl 1.04MB 1.04MB -0.58% (6.16kB)
Type<'db>::apply_specialization_ 214.75kB 210.35kB -2.05% (4.40kB)
Type<'db>::apply_specialization_::interned_arguments 205.47kB 201.09kB -2.13% (4.38kB)
infer_definition_types 1.87MB 1.87MB -0.16% (2.97kB)
Definition 1.98MB 1.98MB +0.14% (2.92kB)
source_text 1.56MB 1.56MB +0.13% (2.06kB)
CallableType 170.58kB 171.42kB +0.49% (864.00B)
Specialization 162.06kB 161.30kB -0.47% (784.00B)
FunctionType 439.91kB 440.62kB +0.16% (736.00B)
InferableTypeVarsInner 26.57kB 26.07kB -1.90% (516.00B)
FunctionType<'db>::signature_ 362.10kB 362.48kB +0.10% (388.00B)
cached_protocol_interface 44.91kB 45.26kB +0.78% (360.00B)
Expression 366.40kB 366.68kB +0.08% (288.00B)
... 23 more

sphinx

Name Old New Diff Outcome
infer_expression_types_impl 20.92MB 20.86MB -0.27% (57.41kB) ⬇️
parsed_module 32.59MB 32.62MB +0.09% (29.71kB) ⬇️
semantic_index 61.12MB 61.14MB +0.04% (23.64kB) ⬇️
Type<'db>::apply_specialization_::interned_arguments 1.46MB 1.44MB -1.26% (18.83kB) ⬇️
Type<'db>::apply_specialization_ 1.65MB 1.63MB -0.86% (14.50kB) ⬇️
Definition 8.13MB 8.14MB +0.06% (4.73kB) ⬇️
source_text 7.28MB 7.29MB +0.05% (3.40kB) ⬇️
infer_deferred_types 5.53MB 5.53MB -0.02% (936.00B) ⬇️
TupleType 564.12kB 563.28kB -0.15% (864.00B) ⬇️
CallableType 1.12MB 1.12MB +0.07% (864.00B) ⬇️
is_redundant_with_impl::interned_arguments 1.73MB 1.73MB -0.03% (528.00B) ⬇️
ScopeId 723.83kB 724.26kB +0.06% (440.00B) ⬇️
is_redundant_with_impl 1.49MB 1.49MB -0.03% (408.00B) ⬇️
FunctionType 3.11MB 3.11MB +0.01% (368.00B) ⬇️
Expression 3.18MB 3.18MB +0.01% (360.00B) ⬇️
... 34 more

@AlexWaygood
Copy link
Copy Markdown
Member

It appears the latest version of typeshed causes us to timeout on ecosystem-analyzer and some of our benchmarks.

@AlexWaygood
Copy link
Copy Markdown
Member

nice PR number though: 24646

@AlexWaygood
Copy link
Copy Markdown
Member

According to Claude:

Root cause

Two specific changes in crates/ty_vendored/vendor/typeshed/stdlib/_operator.pyi: the conversion of add and mul from (Any, Any) -> Any into protocol-based overloads using SupportsAdd/SupportsRAdd and SupportsMul/SupportsRMul.

Reproduction

Built ty in release mode on main, ran against sympy (Py3.12) and static-frame (Py3.11) via --typeshed <dir>, varying only the contents of the typeshed directory.

Baseline (main's typeshed): sympy 1.5s, static-frame 1.4s.
Full PR typeshed: sympy hung >21 min at 5.7 GB RSS before being killed.
Full PR typeshed with only _operator.pyi reverted to main: sympy 1.5s.

So the damage is isolated to _operator.pyi.

Bisection within _operator.pyi

Starting from main's typeshed and applying exactly one of the four new overload groups (add, sub, mul, mod), with a 90s timeout:

Overload applied sympy static-frame
addSupportsAdd/SupportsRAdd overloads hang (>90s, 5.7 GB RSS) hang (>90s)
mulSupportsMul/SupportsRMul overloads hang (>90s) 1.1s
subSupportsSub/SupportsRSub overloads 1.4s
modSupportsMod/SupportsRMod overloads 1.5s

Cross-check: full PR typeshed with just these four overloads (add/sub/mul/mod) reverted back to (Any, Any) -> Any, leaving every other PR change in place (including the new SupportsMod/SupportsRMod protocols added to _typeshed/__init__.pyi): sympy 1.5s. So no other file in the PR contributes.

@AlexWaygood
Copy link
Copy Markdown
Member

Here's a minimized repro of the hang:

from typing import Callable, Protocol

class Foo[In, Out](Protocol):
    def method(self, other: In, /) -> Out: ...

def add[In, Out](a: Foo[In, Out], b: In, /) -> Out: ...
def reduce[T](function: Callable[[T, T], T]) -> T: ...

reduce(add)

operator.add in typeshed is now annotated as def add(a: SupportsAdd[_T_contra, _T_co], b: _T_contra) -> _T_co: ..., the second overload for functools.reduce looks like that one in my example above, and sympy calls something similar to functools.reduce(operator.add, []).

@AlexWaygood AlexWaygood force-pushed the typeshedbot/sync-typeshed branch from f23399a to c0f140b Compare April 15, 2026 17:13
@AlexWaygood AlexWaygood changed the base branch from main to dcreager/avoid-endless-expansion April 15, 2026 17:13
@AlexWaygood AlexWaygood reopened this Apr 15, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Apr 15, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 5 0 4
invalid-method-override 3 0 0
unresolved-attribute 0 1 0
unused-type-ignore-comment 1 0 0
Total 9 1 4

Raw diff:

cki-lib (https://gitlab.com/cki-project/cki-lib)
- tests/test_misc.py:442:71 error[invalid-argument-type] Argument to bound method `add_argument` is incorrect: Expected `Iterable[Unknown] | None`, found `Unknown | str | timedelta`
+ tests/test_misc.py:442:71 error[invalid-argument-type] Argument to bound method `add_argument` is incorrect: Expected `Iterable[Any] | None`, found `Unknown | str | timedelta`

core (https://github.com/home-assistant/core)
- homeassistant/components/google_generative_ai_conversation/entity.py:177:16 error[unresolved-attribute] Object of type `str` has no attribute `decode`

ibis (https://github.com/ibis-project/ibis)
- ibis/common/deferred.py:465:18 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[((a: Any, b: Any, /) -> Any) | ((a: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, b: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, /) -> Any) | ([_T_co](a: _SupportsInversion[_T_co], /) -> _T_co) | ([_T_co](a: _SupportsNeg[_T_co], /) -> _T_co), str].__getitem__(key: ((a: Any, b: Any, /) -> Any) | ((a: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, b: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, /) -> Any) | ((a: _SupportsInversion[_T_co], /) -> _T_co) | ((a: _SupportsNeg[_T_co], /) -> _T_co), /) -> str` cannot be called with key of type `(...) -> Unknown` on object of type `dict[((a: Any, b: Any, /) -> Any) | ((a: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, b: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, /) -> Any) | ([_T_co](a: _SupportsInversion[_T_co], /) -> _T_co) | ([_T_co](a: _SupportsNeg[_T_co], /) -> _T_co), str]`
+ ibis/common/deferred.py:465:18 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[Overload[[_T_contra, _T_co](a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co] | Overload[[_T_contra, _T_co](a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co] | Overload[[_T_contra, _T_co](a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co] | ... omitted 5 union elements, str].__getitem__(key: Overload[(a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co, (a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co] | Overload[(a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co, (a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co] | Overload[(a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co, (a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co] | ... omitted 5 union elements, /) -> str` cannot be called with key of type `(...) -> Unknown` on object of type `dict[Overload[[_T_contra, _T_co](a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co] | Overload[[_T_contra, _T_co](a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co] | Overload[[_T_contra, _T_co](a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co] | ... omitted 5 union elements, str]`
- ibis/common/deferred.py:484:18 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[((a: Any, b: Any, /) -> Any) | ((a: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, b: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, /) -> Any) | ([_T_co](a: _SupportsInversion[_T_co], /) -> _T_co) | ([_T_co](a: _SupportsNeg[_T_co], /) -> _T_co), str].__getitem__(key: ((a: Any, b: Any, /) -> Any) | ((a: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, b: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, /) -> Any) | ((a: _SupportsInversion[_T_co], /) -> _T_co) | ((a: _SupportsNeg[_T_co], /) -> _T_co), /) -> str` cannot be called with key of type `(...) -> Unknown` on object of type `dict[((a: Any, b: Any, /) -> Any) | ((a: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, b: _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT, /) -> Any) | ([_T_co](a: _SupportsInversion[_T_co], /) -> _T_co) | ([_T_co](a: _SupportsNeg[_T_co], /) -> _T_co), str]`
+ ibis/common/deferred.py:484:18 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[Overload[[_T_contra, _T_co](a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co] | Overload[[_T_contra, _T_co](a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co] | Overload[[_T_contra, _T_co](a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co] | ... omitted 5 union elements, str].__getitem__(key: Overload[(a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co, (a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co] | Overload[(a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co, (a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co] | Overload[(a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co, (a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co] | ... omitted 5 union elements, /) -> str` cannot be called with key of type `(...) -> Unknown` on object of type `dict[Overload[[_T_contra, _T_co](a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co] | Overload[[_T_contra, _T_co](a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co] | Overload[[_T_contra, _T_co](a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co] | ... omitted 5 union elements, str]`
+ ibis/util.py:261:45 error[invalid-argument-type] Argument to function `reduce` is incorrect: Expected `Iterable[SupportsRMul[Literal[1], Literal[1]]]`, found `tuple[Literal[7, 24, 60, 1000], ...] | tuple[Literal[4, 3], ...]`

jax (https://github.com/google/jax)
+ jax/_src/internal_test_util/test_harnesses.py:2218:47 error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[SupportsSub[SupportsRSub[Never, Unknown], Unknown]]`, found `Unknown | tuple[Literal[2]]`
+ jax/_src/internal_test_util/test_harnesses.py:2218:62 error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[SupportsRSub[SupportsSub[SupportsRSub[SupportsSub[SupportsRSub[Never, Unknown], Unknown], Unknown], Unknown], Unknown]]`, found `Unknown | tuple[Literal[1]]`

materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/cli/mzcompose.py:1044:9 error[invalid-method-override] Invalid override of method `parse_known_args`: Definition is incompatible with `argparse.ArgumentParser.parse_known_args`
+ misc/python/materialize/cli/mzcompose.py:1056:9 error[invalid-method-override] Invalid override of method `parse_known_args`: Definition is incompatible with `ArgumentParser.parse_known_args`
+ misc/python/materialize/mzcompose/composition.py:101:9 error[invalid-method-override] Invalid override of method `parse_known_args`: Definition is incompatible with `ArgumentParser.parse_known_args`

meson (https://github.com/mesonbuild/meson)
- mesonbuild/msetup.py:392:58 error[invalid-argument-type] Argument to bound method `parse_args` is incorrect: Expected `Sequence[str] | None`, found `(CMDOptions & Top[list[Unknown]]) | list[str]`
+ mesonbuild/msetup.py:392:58 error[invalid-argument-type] Argument to bound method `parse_args` is incorrect: Expected `Iterable[str] | None`, found `(CMDOptions & Top[list[Unknown]]) | list[str]`

mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/utils/strutils.py:125:43 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/server/utilities/database.py:528:50 error[invalid-argument-type] Argument to function `_sqlite_strfinterval` is incorrect: Expected `ColumnElement[int | float]`, found `ColumnElement[str] | ColumnElement[Any]`

sympy (https://github.com/sympy/sympy)
+ sympy/tensor/array/expressions/array_expressions.py:405:13 error[invalid-argument-type] Argument to function `reduce` is incorrect: Expected `(Unknown | Basic, Unknown | Basic, /) -> Unknown | Basic`, found `Overload[[_T_contra, _T_co](a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co, [_T_contra, _T_co](a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co]`

Full report with detailed diff (timing results)

Base automatically changed from dcreager/avoid-endless-expansion to main April 15, 2026 18:51
@AlexWaygood AlexWaygood force-pushed the typeshedbot/sync-typeshed branch from c0f140b to ad0ac77 Compare April 15, 2026 19:32
@AlexWaygood AlexWaygood merged commit 61f9a0a into main Apr 15, 2026
56 checks passed
@AlexWaygood AlexWaygood deleted the typeshedbot/sync-typeshed branch April 15, 2026 19:45
@AlexWaygood
Copy link
Copy Markdown
Member

(The hangs were fixed after rebasing on top of #24660 -- thanks @dcreager!!)

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

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants