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 | dd4f32ba7aee178c538e0a27e0b66ff6d3a57d65 (patch) | |
tree | 165dfba074642844335e257a7911ec2494aaa735 | |
parent | 1fcb59ae379d62145ca7c5187338ffe4e64d587d (diff) | |
download | logilab-common-dd4f32ba7aee178c538e0a27e0b66ff6d3a57d65.tar.gz |
[modutils] Ensure module is actually in sys.modules in pkg_resources support
Wrap the long line along the way.
Closes #269083.
-rw-r--r-- | modutils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modutils.py b/modutils.py index ec7370e..a426a3a 100644 --- a/modutils.py +++ b/modutils.py @@ -616,7 +616,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)] |