summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2014-07-23 17:44:42 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2014-07-23 17:44:42 +0200
commitafda8c7358c88969d66b3d205103b26967858713 (patch)
treef93d6befa8133bd2976e845dc1b1e5ee21264d19
parentc141ccdb55553bc35d38874826a0304df7f96596 (diff)
downloadpylint-afda8c7358c88969d66b3d205103b26967858713.tar.gz
fix issue #203, we should not let ImportError propagate from the import checker
-rw-r--r--ChangeLog4
-rw-r--r--checkers/imports.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d2006a..e27c966 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,10 @@ ChangeLog for Pylint
* Don't emit 'unused-variable' when assigning to a nonlocal.
Closes issue #275.
+
+ * Do not let ImportError propagate from the import checker, leading to crash
+ in some namespace package related cases. Closes issue #203.
+
2014-04-30 -- 1.2.1
* Restore the ability to specify the init-hook option via the
diff --git a/checkers/imports.py b/checkers/imports.py
index 46ed8ac..7194134 100644
--- a/checkers/imports.py
+++ b/checkers/imports.py
@@ -299,7 +299,10 @@ given file (report RP0402 must not be disabled)'}
def _add_imported_module(self, node, importedmodname):
"""notify an imported module, used to analyze dependencies"""
- importedmodname = get_module_part(importedmodname)
+ try:
+ importedmodname = get_module_part(importedmodname)
+ except ImportError:
+ pass
context_name = node.root().name
if context_name == importedmodname:
# module importing itself !