-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Consider reversed operands order when comparing version info #10288
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
Consider reversed operands order when comparing version info #10288
Conversation
mypy/reachability.py
Outdated
index = contains_sys_version_info(expr.operands[1]) | ||
thing = contains_int_or_tuple_of_ints(expr.operands[0]) | ||
op = reverse_op[op] | ||
if index is None or thing is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is redundant, since the conditions below won't trigger if either value is None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. Good point 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the redundant check.
@JelleZijlstra One job on Travis CI has failed for some weird reason, doesn't look like thing related to this PR. |
Yeah that looks harmless. I'll merge this PR, thanks for your contributions! |
Consider reversed operands order when comparing version info (python#10288)
Description
Closes #10264.
Consider reversed order of operands when trying to compare version info. When reversed order is used, operator is reversed as well for correct comparison.