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

Missing return statement" error misfires on with blocks #10961

Closed
eric-wieser opened this issue Aug 10, 2021 · 1 comment
Closed

Missing return statement" error misfires on with blocks #10961

eric-wieser opened this issue Aug 10, 2021 · 1 comment
Labels
bug mypy got something wrong

Comments

@eric-wieser
Copy link
Contributor

eric-wieser commented Aug 10, 2021

Bug Report

The "Missing return statement" error misfires on with blocks.

To Reproduce

Create the following python file:

import contextlib

def foo() -> int:
	with contextlib.ExitStack() as stack:
		return 2

Run mypy:

Expected Behavior

There should be no error

Actual Behavior

this_issue.py:3: error: Missing return statement
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: 0.910
  • Python version used: 3.8
  • Operating system and version: Windows 10
@eric-wieser eric-wieser added the bug mypy got something wrong label Aug 10, 2021
@eric-wieser
Copy link
Contributor Author

Oh, duplicate of #7726

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

No branches or pull requests

1 participant