You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
iter(obj) incompatible with obj.__iter__() if class generic in constrained TypeVar #16552
This happens when using a class whose behavior depends on a constrained TypeVar. It seems that it naively uses the first overload when inferring the type of iter(obj). There's also a false positive when checking compatibility with Iterable, I guess it just tests if some overload matches?
For reference, pyright is fine with all the assert_type statements and catches the false positives, but complains about "Overloaded implementation is not consistent with signature"...
Activity
randolf-scholz commentedon Nov 24, 2023
For reference,
pyrightis fine with all theassert_typestatements and catches the false positives, but complains about "Overloaded implementation is not consistent with signature"...randolf-scholz commentedon Feb 14, 2025
Seems this was fixes in 1.12, closing. https://mypy-play.net/?mypy=1.12.0&python=3.13&gist=16484625f51cb1bc0145c60b983369b1