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 | 5a9c849d47a296190f7f4167e4422d3e334ed519 (patch) | |
tree | dd505daa7e8b919285bc989dba119cee042d35b4 /astroid/mixins.py | |
parent | 59c9bb1169d3b200a8611e427b3a45e5b994ad78 (diff) | |
download | astroid-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.py | 4 |
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)) |