Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions mypy/modulefinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,12 +684,22 @@ def matches_exclude(
if fscache.isdir(subpath):
subpath_str += "/"
for exclude in excludes:
if re.search(exclude, subpath_str):
if verbose:
print(
f"TRACE: Excluding {subpath_str} (matches pattern {exclude})", file=sys.stderr
)
return True
try:
if re.search(exclude, subpath_str):
if verbose:
print(
f"TRACE: Excluding {subpath_str} (matches pattern {exclude})",
file=sys.stderr,
)
return True
except re.error as e:
print(f"error: The exclude {exclude} is an invalid regular expression, because:", e)
if "\\" in exclude:
print("(Hint: use / as a path separator, even if you're on Windows!)")
print(
"For more information on Python's flavor of regex, see: https://docs.python.org/3/library/re.html"
)
sys.exit(2)
return False


Expand Down