Skip to content

"None" has no attribute "foo" #4538

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
matthiaskramm opened this issue Feb 3, 2018 · 2 comments
Closed

"None" has no attribute "foo" #4538

matthiaskramm opened this issue Feb 3, 2018 · 2 comments
Labels
bug mypy got something wrong priority-0-high

Comments

@matthiaskramm
Copy link
Contributor

Given

x = None
if x is not None:
  x.foo()

running mypy file.py reports:

file.py:3: error: "None" has no attribute "foo"

mypy version: mypy 0.570-dev-8ec7046787f92bf7b00d0c70f570fcb5d75e4b53

Passing --strict-optional makes the problem go away.

@emmatyping emmatyping added bug mypy got something wrong priority-0-high labels Feb 3, 2018
@bwo
Copy link
Contributor

bwo commented Feb 5, 2018

seems like this is related: #4520

@emmatyping
Copy link
Member

I think this is in fact a duplicate of #4520, closing this as that issue has more discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong priority-0-high
Projects
None yet
Development

No branches or pull requests

3 participants