8000 Only consider meta variables in ambiguous "any of" constraints by sterliakov · Pull Request #18986 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Only consider meta variables in ambiguous "any of" constraints #18986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prev Previous commit
Add comment from review
  • Loading branch information
sterliakov committed May 6, 2025
commit e4126864af181aeade1ee4ccf10b144888ce39b9
3 changes: 3 additions & 0 deletions mypy/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,9 @@ def any_constraints(options: list[list[Constraint] | None], *, eager: bool) -> l
return any_constraints(filtered_options, eager=eager)

# Try harder: if that didn't work, try to strip typevars that aren't meta vars.
# Note this is what we would always do, but unfortunately some callers may not
# set the meta var status correctly (for historical reasons), so we use this as
# a fallback only.
filtered_options = [exclude_non_meta_vars(o) for o in options]
if filtered_options != options:
return any_constraints(filtered_options, eager=eager)
Expand Down
0