Skip to content

Commit

Permalink
Handle failure case when converting abspath to relpath
Browse files Browse the repository at this point in the history
  • Loading branch information
bonprosoft committed Jul 4, 2020
1 parent c1f7d1e commit 03f4b42
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2807,11 +2807,16 @@ def load_graph(sources: List[BuildSource], manager: BuildManager,

if seen_state is None:
if os.path.isabs(newst_path):
newst_path = os.path.relpath(newst_path)
try:
newst_path = os.path.relpath(newst_path)
except ValueError:
# Ignore when newst_path does not start with os.curdir
pass
else:
seen_state = seen_files.get(newst_path)
else:
newst_path = os.path.abspath(newst_path)

seen_state = seen_files.get(newst_path)
seen_state = seen_files.get(newst_path)

if seen_state is not None:
manager.errors.report(
Expand Down

0 comments on commit 03f4b42

Please sign in to comment.