summaryrefslogtreecommitdiff
path: root/astroid/mixins.py
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
commit5a9c849d47a296190f7f4167e4422d3e334ed519 (patch)
treedd505daa7e8b919285bc989dba119cee042d35b4 /astroid/mixins.py
parent59c9bb1169d3b200a8611e427b3a45e5b994ad78 (diff)
downloadastroid-git-5a9c849d47a296190f7f4167e4422d3e334ed519.tar.gz
Reraise InferenceError with the syntax error that lead to a failed do_import_module call.
Diffstat (limited to 'astroid/mixins.py')
-rw-r--r--astroid/mixins.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/astroid/mixins.py b/astroid/mixins.py
index dbf1673a..185ff16c 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))