summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Laxalde <denis.laxalde@logilab.fr>2014-10-24 12:04:39 +0200
committerDenis Laxalde <denis.laxalde@logilab.fr>2014-10-24 12:04:39 +0200
commitdd4f32ba7aee178c538e0a27e0b66ff6d3a57d65 (patch)
tree165dfba074642844335e257a7911ec2494aaa735
parent1fcb59ae379d62145ca7c5187338ffe4e64d587d (diff)
downloadlogilab-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.py5
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)]