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

Type error: sys.version_info == (3, 4) #672

Closed
elazarg opened this issue Nov 9, 2016 · 4 comments
Closed

Type error: sys.version_info == (3, 4) #672

elazarg opened this issue Nov 9, 2016 · 4 comments

Comments

@elazarg
Copy link
Contributor

elazarg commented Nov 9, 2016

I have tried changing the signature of object.__eq__ to (T, T)->bool, and mypy warns about the comparison in importlib/abc.pyi:

    if sys.version_info == (3, 4):

_version_info subtypes Tuple[int, int, int, str, int] and can never be equal to (3, 4).

>>> from sys import version_info
>>> version_info
sys.version_info(major=3, minor=4, micro=3, releaselevel='final', serial=0)
>>> version_info == (3, 4)
False

I think the generic signature is helpful, even though it's overly restrictive.

@gvanrossum
Copy link
Member

I don't understand what you're trying to say, unless you just mean that the code in importlib/abc.pyi is wrong -- it should be if sys.version_info[:2] == (3, 4):.

@elazarg
Copy link
Contributor Author

elazarg commented Nov 9, 2016

Yes, that's what I mean.
(I also wanted to add the note about generic __eq__)

@gvanrossum
Copy link
Member

gvanrossum commented Nov 9, 2016 via email

@elazarg
Copy link
Contributor Author

elazarg commented Nov 9, 2016

Done (#673).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants