Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Mypy incorrectly accepts pass as returning List[int] #6139

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
marmistrz opened this issue Jan 4, 2019 · 1 comment
Closed

Mypy incorrectly accepts pass as returning List[int] #6139

marmistrz opened this issue Jan 4, 2019 · 1 comment

Comments

@marmistrz
Copy link

marmistrz commented Jan 4, 2019

mypy 0.650

Take the following source:

from typing import List

def foo(x: int) -> List[int]:
    pass

print(foo(3)[0])

Lint with mypy --strict test.py - nothing reported.
During runtime:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    print(foo(3)[0])
TypeError: 'NoneType' object is not subscriptable

return None instead of pass raises an error, though.

@ilevkivskyi
Copy link
Member

This is a duplicate of #2350

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