summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-01-02 16:14:44 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-01-02 16:14:44 -0500
commit3a0c714c6f9baa032c5425c04d59e567b13fea6c (patch)
tree7bbf281b4fd2666ad3c2b961ad942da3fecfde67
parent24647f385e3776f64c711b0a82fea18849e0f139 (diff)
downloadpython-setuptools-bitbucket-3a0c714c6f9baa032c5425c04d59e567b13fea6c.tar.gz
Based on experimentation, the canonical module name needs to be in sys.modules on Python prior to 3.3, but must be omitted on Python 3.3 and later.
-rw-r--r--pkg_resources/extern/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py
index 944967c2..9b1599f8 100644
--- a/pkg_resources/extern/__init__.py
+++ b/pkg_resources/extern/__init__.py
@@ -29,7 +29,10 @@ class VendorImporter:
for prefix in self.search_path:
try:
__import__(prefix + target)
- mod = sys.modules[fullname] = sys.modules.pop(prefix + target)
+ mod = sys.modules[prefix + target]
+ sys.modules[fullname] = mod
+ if sys.version_info > (3, 3):
+ del sys.modules[prefix + target]
return mod
except ImportError:
pass