Skip to content

Commit ae11258

Browse files
authored
Fix exception causes in stubutil.py
1 parent 84bcb25 commit ae11258

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mypy/stubutil.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def find_module_path_and_all_py2(module: str,
9191
except subprocess.CalledProcessError as e:
9292
path = find_module_path_using_py2_sys_path(module, interpreter)
9393
if path is None:
94-
raise CantImport(module, str(e))
94+
raise CantImport(module, str(e)) from e
9595
return path, None
9696
output = output_bytes.decode('ascii').strip().splitlines()
9797
module_path = output[0]
@@ -153,7 +153,7 @@ def find_module_path_and_all_py3(inspect: ModuleInspect,
153153
# Fall back to finding the module using sys.path.
154154
path = find_module_path_using_sys_path(module, sys.path)
155155
if path is None:
156-
raise CantImport(module, str(e))
156+
raise CantImport(module, str(e)) from e
157157
return path, None
158158
if mod.is_c_module:
159159
return None

0 commit comments

Comments
 (0)