diff options
author | Denis Laxalde <denis.laxalde@logilab.fr> | 2014-10-24 12:04:39 +0200 |
---|---|---|
committer | Denis Laxalde <denis.laxalde@logilab.fr> | 2014-10-24 12:04:39 +0200 |
commit | 7de71ac6368676f098cdd37ad8d5dffe79a82b10 (patch) | |
tree | 14835405c0cfa4b856bcb36a940060fffb6cf624 | |
parent | 22181e2b6ebaf3f6c4739188fd187069e11c661b (diff) | |
download | astroid-git-7de71ac6368676f098cdd37ad8d5dffe79a82b10.tar.gz |
[modutils] Ensure module is actually in sys.modules in pkg_resources support
Wrap the long line along the way.
Closes #52.
-rw-r--r-- | modutils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modutils.py b/modutils.py index 1f4a4fc5..7b3840b3 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)] |