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
Nondeterministic output when using tuple type vars #20344
Expected Behavior
Mypy should give a consistent output, either approve or deny the code.
Actual Behavior
I get two different outputs if I run it 3-4 times:
Success: no issues found in 1 source file
test.py:43: error: Returning Any from function declared to return "_Single | _Multiple" [no-any-return]
Found 1 error in 1 file (checked 1 source file)
Notes
The code might seem strange and is just something I cooked out of our real life use case (DB queries with SQLAlchemy).
Perhaps I'm using an incorrect pattern here in the first place?
Your Environment
Mypy version used: 1.20.0+dev.ad0f41eea63ef227739b66f08afbb67544597d79 (compiled: no)
Activity
hauntsaninja commentedon Dec 1, 2025
Thanks for the great repro!
Bisects to #16345 , which isn't the most helpful
Slightly trimmed down version of your repro:
hauntsaninja commentedon Dec 1, 2025
Looks like another case of non-commutative join, looking more...
Fix noncommutative joins with bounded TypeVars
Fix noncommutative joins with bounded TypeVars (#20345)
Fix noncommutative joins with bounded TypeVars (#20345)