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

Code unreachable according to mypyc but not according to mypy #10703

Closed
twoertwein opened this issue Jun 23, 2021 · 1 comment
Closed

Code unreachable according to mypyc but not according to mypy #10703

twoertwein opened this issue Jun 23, 2021 · 1 comment
Labels
bug mypy got something wrong

Comments

@twoertwein
Copy link

twoertwein commented Jun 23, 2021

Bug Report

Different behavior between mypy and mypyc.

To Reproduce

from pathlib import Path
from typing import TypeVar

PathNone = TypeVar("PathNone", Path, None)


def test(path: PathNone) -> PathNone:
    if path is None:
        return path  # is reachable
    return path / "test"
$ mypy test.py
Success: no issues found in 1 source file
$ mypyc test.py
test.py:9: error: Statement is unreachabl

Your Environment

  • Mypy version used: 0.910
  • Mypy command-line flags: -
  • Mypy configuration options from pyproject.toml: warn_unreachable = true
  • Python version used: 3.9.4
  • Operating system and version: 4.13.0-36-generic
@twoertwein twoertwein added the bug mypy got something wrong label Jun 23, 2021
@twoertwein
Copy link
Author

Works with 0.931

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