Skip to content
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

A random hack to try fixing performace issues #14276

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions mypy/subtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ def check_item(left: Type, right: Type, subtype_context: SubtypeContext) -> bool
is_subtype_of_item = any(
check_item(orig_left, item, subtype_context) for item in right.items
)
if proper_subtype:
# This is a hack to avoid some performance issues, see #13821
return is_subtype_of_item
# Recombine rhs literal types, to make an enum type a subtype
# of a union of all enum items as literal types. Only do it if
# the previous check didn't succeed, since recombining can be
Expand Down