summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2015-03-18 13:33:58 +0200
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2015-03-18 13:33:58 +0200
commit3d47682a423e6c7ff793d9dc39eefb6294e4b4a6 (patch)
tree3f2fe0f24527b70f944288c25b5af84bbabbe5ec
parent889c0d3aee96723ff68f9efa3a246c2bd8213d5e (diff)
downloadastroid-3d47682a423e6c7ff793d9dc39eefb6294e4b4a6.tar.gz
Reraise InferenceError with the syntax error that lead to a failed do_import_module call.
-rw-r--r--astroid/mixins.py4
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))