summaryrefslogtreecommitdiff
path: root/modutils.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2014-10-30 15:27:56 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2014-10-30 15:27:56 +0200
commit8209c01eded5b8d533136bb9f04bfe3a851f8cdc (patch)
tree6e5336d582e7bf2493847b59f6a5b3470551aecc /modutils.py
parent7dadecf9120d1ab1340579ed011e91d217af1600 (diff)
parent7de71ac6368676f098cdd37ad8d5dffe79a82b10 (diff)
downloadastroid-git-8209c01eded5b8d533136bb9f04bfe3a851f8cdc.tar.gz
Merged in dlax/astroid (pull request #59)
[modutils] Ensure module is actually in sys.modules in pkg_resources support
Diffstat (limited to 'modutils.py')
-rw-r--r--modutils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/modutils.py b/modutils.py
index 66a7a4ac..efc999b4 100644
--- a/modutils.py
+++ b/modutils.py
@@ -552,7 +552,10 @@ def _module_file(modpath, path=None):
except AttributeError:
checkeggs = False
# pkg_resources support (aka setuptools namespace packages)
- if pkg_resources is not None and modpath[0] in pkg_resources._namespace_packages and len(modpath) > 1:
+ if (pkg_resources is not None
+ and modpath[0] in pkg_resources._namespace_packages
+ and modpath[0] in sys.modules
+ and len(modpath) > 1):
# setuptools has added into sys.modules a module object with proper
# __path__, get back information from there
module = sys.modules[modpath.pop(0)]