Skip to content

False positive: unreachable #10806

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

Open
KotlinIsland opened this issue Jul 12, 2021 · 1 comment
Open

False positive: unreachable #10806

KotlinIsland opened this issue Jul 12, 2021 · 1 comment
Labels
bug mypy got something wrong false-positive mypy gave an error on correct code topic-reachability Detecting unreachable code

Comments

@KotlinIsland
Copy link
Contributor

Bug Report

false positive unreachable

To Reproduce

a: object = None

def foo() -> None:
    global a
    a = None
    bar()
    if a:
        print("hi")

def bar() -> None:
    global a
    a = 1

Expected Behavior

no error

Actual Behavior

main.py:8: error: Statement is unreachable
Found 1 error in 1 file (checked 1 source file)

(Write what happened.)

Your Environment
https://mypy-play.net/?mypy=latest&python=3.10&flags=warn-unreachable&gist=c41cd432e95c591743aa1369f36823d1

@KotlinIsland KotlinIsland added the bug mypy got something wrong label Jul 12, 2021
@Akuli
Copy link
Contributor

Akuli commented Oct 5, 2021

related: #10634

@97littleleaf11 97littleleaf11 added the false-positive mypy gave an error on correct code label Feb 19, 2022
@AlexWaygood AlexWaygood added the topic-reachability Detecting unreachable code label Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong false-positive mypy gave an error on correct code topic-reachability Detecting unreachable code
Projects
None yet
Development

No branches or pull requests

4 participants