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

wrong unreachable, it is reachable #12161

Closed
joshinils opened this issue Feb 10, 2022 · 2 comments
Closed

wrong unreachable, it is reachable #12161

joshinils opened this issue Feb 10, 2022 · 2 comments
Labels
bug mypy got something wrong

Comments

@joshinils
Copy link

Bug Report
The following example-bit of code produces an error which does not exist at runtime

a = None
for i in range(2):
    print(i)

    if a is None:
        a = 7
        continue

    print("a =", a)  # this is line 9
    b: int = "b"

Error:

file.py:9:5: error: Statement is unreachable  [unreachable]
        print("a =", a)
        ^
Found 1 error in 1 file (checked 1 source file)

Output:

0
1
a = 7

Expected Behavior
No error reporting.

Your Environment

  • Mypy version used: mypy 0.931
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files):
    .mypy.ini:
# type: ignore

[mypy-requests.*]
ignore_missing_imports = True

[mypy-*/migrations/*]
# Django migrations should not produce any errors:
ignore_errors = True


[mypy]
ignore_missing_imports = False
; disallow_any_expr = True
disallow_any_explicit = True
disallow_untyped_calls = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
check_untyped_defs = True
disallow_untyped_decorators = True
no_implicit_optional = True
warn_redundant_casts = True
warn_unused_ignores = True
warn_no_return = True
warn_return_any = True
warn_unreachable = True
strict_equality = True
show_error_context = True
show_column_numbers = True
show_error_codes = True
pretty = True
show_absolute_path = True 
  • Python version used: Python 3.8.10
  • Operating system and version: Ubuntu 20.04.3 LTS
@joshinils joshinils added the bug mypy got something wrong label Feb 10, 2022
@KotlinIsland
Copy link
Contributor

duplicate of #11612

@joshinils
Copy link
Author

so it is

duplicate of #11612

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

2 participants