Skip to content

Selected Typeshed stubs for the wrong version #2153

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

Closed
berdario opened this issue Sep 18, 2016 · 3 comments
Closed

Selected Typeshed stubs for the wrong version #2153

berdario opened this issue Sep 18, 2016 · 3 comments

Comments

@berdario
Copy link

From my understanding, 2and3 stubs should be ovverriden by 3, which should be overriden by 3.5 (assuming 3.5)

After updating to Mypy 0.4.4 (from 0.4.1) though I get a new spurious error:

No overload variant of "itemgetter" matches argument types [builtins.str]

The code for itemgetter here seems correct:

https://github.com/python/typeshed/blob/master/stdlib/3/_operator.pyi

But here instead it's picking up

 def itemgetter(item: int)

https://github.com/python/typeshed/blob/master/stdlib/2and3/operator.pyi

Why is the code from 2and3 used, instead of the more specific one?

@gvanrossum
Copy link
Member

Presumably because these are two different modules -- _operator is the builtin one, and operator is the public one. So neither is overriding the other. OTOH I suspect _operator should be deleted since everybody should be using the public one.

I haven't found time to look more into which definition of itemgetter is more correct. Can you cook up a little example demonstrating the error you are getting?

@gvanrossum
Copy link
Member

Oh, also, this is in any case an issue for https://github.com/python/typeshed/issues, not for mypy.

@berdario berdario changed the title Wrong typeshed stubs Selected Typeshed stubs for the wrong version Sep 18, 2016
@berdario
Copy link
Author

berdario commented Sep 19, 2016

Oh, I assumed that since a module like operator usually imports _operator, that mypy would've had some machinery to include that...

Thank you, unfortunately I was a bit in a hurry (otherwise I'd have changed the pyi on my own), but I now reopened this in the typeshed project

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