-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Python version check is sensitive to comparison order #10264
Comments
Hey, @paw-lu , I want to work on this issue. But I am new to open source projects. Is it also applicable for windows? |
Hi @Pank3 ! While I admitedly haven't tested it on Windows—I expect it should be applicable! |
@Pank3 I beleive (but am not sure) the problem orginates somewhere around Lines 112 to 150 in bab4e22
|
@paw-lu do you think adding this case in that function will solve this issue or there are any other files that need to be changed too? are there any more such cases that need to be included? |
Honestly not sure! We'll have to play with it to find out. This was just an initial pointer to those interested in helping out.
For now, I think just taking into account the reverse order of the supported comparison operations is good. If people are interested in more complex operations support for that can be added later. |
@paw-lu
I think it's adequate and correct, but it makes a bunch of test cases fail, mainly it gives out |
Is this a problem related to only mac OS or it will arise on windows also? |
I believe it's for all the platforms |
Hi, first timer here and I have been following this problem and working on it for class in which I need to submit a pull request for an open-source project issue and I'm at a point where I expected to submit my PR for this in the next week or so. However, I see that another PR has already been submitted. Would I still be able to submit my own attempt at a solution in that timeframe and possibly receive some feedback even if its not chosen to be merged in? It would be really appreciated and save me from having to scrap my progress and restart elsewhere. |
@alvaroq10 we're having trouble keeping up with PRs as is, we're unlikely to look much at a PR for a problem that already has a solution. |
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.
Bug Report
Whether mypy successfully detects a Python version check is dependent on the order of the comparison.
To Reproduce
Expected Behavior
I expected mypy to correctly parse the Python version check regardless of the order of the comparison.
Actual Behavior
(3, 8) <= sys.version_info
is not correctly detected by mypy, while the logically equivalentsys.version_info >= (3, 8)
is.Your Environment
--python-version 3.8
mypy.ini
(and other config files): EmptyThe text was updated successfully, but these errors were encountered: