From d3180eafff77fc6eb56d0418e997cd6e0f31ede8 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Mon, 30 May 2022 15:13:30 -0400 Subject: Reraise failures in astroid as `AstroidError` --- pylint/lint/pylinter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pylint/lint') diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index 0dc9b8c0d..63eb84e10 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -695,6 +695,7 @@ class PyLinter( :param callable check_astroid_module: callable checking an AST taking the following arguments - ast: AST of the module :param FileItem file: data about the file + :raises AstroidError: for any failures stemming from astroid """ self.set_current_module(file.name, file.filepath) # get the module representation @@ -708,7 +709,10 @@ class PyLinter( # fix the current file (if the source file was not available or # if it's actually a c extension) self.current_file = ast_node.file - check_astroid_module(ast_node) + try: + check_astroid_module(ast_node) + except Exception as e: # pragma: no cover + raise astroid.AstroidError from e # warn about spurious inline messages handling spurious_messages = self.file_state.iter_spurious_suppression_messages( self.msgs_store -- cgit v1.2.1