diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-03-18 13:33:58 +0200 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-03-18 13:33:58 +0200 |
commit | 3d47682a423e6c7ff793d9dc39eefb6294e4b4a6 (patch) | |
tree | 3f2fe0f24527b70f944288c25b5af84bbabbe5ec | |
parent | 889c0d3aee96723ff68f9efa3a246c2bd8213d5e (diff) | |
download | astroid-3d47682a423e6c7ff793d9dc39eefb6294e4b4a6.tar.gz |
Reraise InferenceError with the syntax error that lead to a failed do_import_module call.
-rw-r--r-- | astroid/mixins.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/astroid/mixins.py b/astroid/mixins.py index dbf1673..185ff16 100644 --- a/astroid/mixins.py +++ b/astroid/mixins.py @@ -105,7 +105,9 @@ class FromImportMixIn(FilterStmtsMixin): return mymodule try: return mymodule.import_module(modname, level=level) - except AstroidBuildingException: + except AstroidBuildingException as ex: + if isinstance(ex.args[0], SyntaxError): + raise InferenceError(str(ex)) raise InferenceError(modname) except SyntaxError as ex: raise InferenceError(str(ex)) |