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

False positive with warn-unreachable and no-strict-optional #16787

Closed
Garrett-R opened this issue Jan 15, 2024 · 1 comment
Closed

False positive with warn-unreachable and no-strict-optional #16787

Garrett-R opened this issue Jan 15, 2024 · 1 comment
Labels
bug mypy got something wrong

Comments

@Garrett-R
Copy link

Bug Report

Mypy warns that a line is unreachable, when it actually is reachable. I don't think this is a Typeshed issue given the typing looks fine there.

To Reproduce

Mypy playground. Repeated here for convenience:

import re

if not re.search('a', 'b'):
    print('no match')  # This is indeed reachable!

Expected Behavior

No Mypy errors

Actual Behavior

Says the print statement is unreachable, yet if you execute the code, it'll hit the print line.

Your Environment

  • Mypy version used: 1.8.0
  • Mypy command-line flags: --no-strict-optional, --warn-unreachable
  • Python version used: 3.12
@Garrett-R Garrett-R added the bug mypy got something wrong label Jan 15, 2024
@AlexWaygood
Copy link
Member

Duplicate of #16718

@AlexWaygood AlexWaygood marked this as a duplicate of #16718 Jan 15, 2024
@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2024
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