summaryrefslogtreecommitdiff
path: root/mixins.py
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2010-10-21 11:44:26 +0200
committerEmile Anclin <emile.anclin@logilab.fr>2010-10-21 11:44:26 +0200
commit6d59ad07d722d01e458aaf8fd14fd7dfc7ebaa6e (patch)
tree2dd9b9a68192d8bfaca12402967de897ee3fb5a7 /mixins.py
parent75d0203dcaab646aa73afdb1646425b4cbe3bc1a (diff)
downloadastroid-git-6d59ad07d722d01e458aaf8fd14fd7dfc7ebaa6e.tar.gz
fix Module.getattr and rename "absolute_modname" to "relative_to_absolute_name"
This renaming is done because there is actually no simple way to know if we are on an absolute import or on an implicit relative import. And the "absolute_import_activated" killed the relative import we just wanted in case of "relative_only" option.
Diffstat (limited to 'mixins.py')
-rw-r--r--mixins.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mixins.py b/mixins.py
index 2a027ec9..c3614d76 100644
--- a/mixins.py
+++ b/mixins.py
@@ -139,7 +139,9 @@ class FromImportMixIn(BaseClass, FilterStmtsMixin):
# XXX: no more needed ?
mymodule = self.root()
level = getattr(self, 'level', None) # Import as no level
- if mymodule.absolute_modname(modname, level) == mymodule.name:
+ # XXX we should investigate deeper if we really want to check
+ # importing itself: modname and mymodule.name be relative or absolute
+ if mymodule.relative_to_absolute_name(modname, level) == mymodule.name:
# FIXME: I don't know what to do here...
raise InferenceError('module importing itself: %s' % modname)
try: