Closed as not planned
Description
Bug Report
Tests with re.match
or re.search
give incorrect unreachable error when using mypy 1.8.0
To Reproduce
import re
test_str = "XYZ"
if re.match("ABC", test_str):
print("match")
else:
print("no match")
Expected Behavior
No mypy errors
Actual Behavior
> mypy test.py
test.py:10: error: Statement is unreachable [unreachable]
print("no match")
^~~~~~~~~~~~~~~~~
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 1.8.0
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini
(and other config files):
python_version = "3.12"
check_untyped_defs = true
# We don't have stubs for all libraries
ignore_missing_imports = true
# We need some ignores for Pylance
follow_imports = "normal"
ignore_errors = false
show_error_codes = true
pretty = true
# Strictness
allow_redefinition = false
implicit_reexport = true
local_partial_types = true
no_implicit_optional = true
strict_equality = true
strict_optional = false
# Warnings
warn_no_return = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true
- Python version used: 3.12