aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-12-13 21:38:48 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-12-13 21:38:48 -0500
commit7c0c39ef1f60571709e5a8e6680f2147c38cd4ff (patch)
treef3a0072cd388a959a9633a5741f74645dcbcbe75
parent3e05a9630ff0e0596a539d4b6d24f97d3fb987f8 (diff)
downloadexternal_python_setuptools-7c0c39ef1f60571709e5a8e6680f2147c38cd4ff.tar.gz
external_python_setuptools-7c0c39ef1f60571709e5a8e6680f2147c38cd4ff.tar.bz2
external_python_setuptools-7c0c39ef1f60571709e5a8e6680f2147c38cd4ff.zip
Bypass sort behavior altogether when module.__path__ isn't a list. Fixes #885.
-rw-r--r--pkg_resources/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index d0f66274..4c9868c7 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2113,7 +2113,11 @@ def _rebuild_mod_path(orig_path, package_name, module):
parts = path_parts[:-module_parts]
return safe_sys_path_index(_normalize_cached(os.sep.join(parts)))
- orig_path[:] = sorted(orig_path, key=position_in_sys_path)
+ if not isinstance(orig_path, list):
+ # Is this behavior useful when module.__path__ is not a list?
+ return
+
+ orig_path.sort(key=position_in_sys_path)
module.__path__[:] = [_normalize_cached(p) for p in orig_path]