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

Issue a blocking error early if builtins can't be found #4327

Merged
merged 1 commit into from Dec 6, 2017
Jump to file or symbol
Failed to load files and symbols.
+9 −5
Diff settings

Always

Just for now

Copy path View file
@@ -651,12 +651,16 @@ def parse_file(self, id: str, path: str, source: str, ignore_errors: bool) -> My
self.errors.set_file_ignored_lines(path, tree.ignored_lines, ignore_errors)
return tree
def module_not_found(self, path: str, id: str, line: int, target: str) -> None:
self.errors.set_file(path, id)
def module_not_found(self, path: str, source: str, line: int, target: str) -> None:
self.errors.set_file(path, source)
stub_msg = "(Stub files are from https://github.com/python/typeshed)"
if ((self.options.python_version[0] == 2 and moduleinfo.is_py2_std_lib_module(target)) or
(self.options.python_version[0] >= 3 and
moduleinfo.is_py3_std_lib_module(target))):
if target == 'builtins':
self.errors.report(line, 0, "Cannot find 'builtins' module. Typeshed appears broken!",
blocker=True)
self.errors.raise_error()
elif ((self.options.python_version[0] == 2 and moduleinfo.is_py2_std_lib_module(target))
or (self.options.python_version[0] >= 3
and moduleinfo.is_py3_std_lib_module(target))):
self.errors.report(
line, 0, "No library stub file for standard library module '{}'".format(target))
self.errors.report(line, 0, stub_msg, severity='note', only_once=True)
ProTip! Use n and p to navigate between commits in a pull request.