[Python-checkins] cpython: Revert to os.path.join() semantics for path manipulation in importlib

brett.cannon python-checkins at python.org
Sun Apr 22 08:06:55 CEST 2012


http://hg.python.org/cpython/rev/9adfe3c0fe48
changeset:   76466:9adfe3c0fe48
parent:      76462:0a63868c5e95
user:        Brett Cannon <brett at python.org>
date:        Sun Apr 22 02:06:23 2012 -0400
summary:
  Revert to os.path.join() semantics for path manipulation in importlib
which is different than what imp.cache_from_source() operates on.

files:
  Lib/importlib/_bootstrap.py |   13 ++-----------
  Python/importlib.h          |  Bin 
  2 files changed, 2 insertions(+), 11 deletions(-)


diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -65,17 +65,8 @@
 #     and choosing in _setup().
 def _path_join(*args):
     """Replacement for os.path.join()."""
-    if len(path_separators) == 1:
-        sep = path_sep
-    else:
-        for x in reversed(args[0]):
-            if x in path_separators:
-                sep = x
-                break
-        else:
-            sep = path_sep
-    return sep.join(x[:-len(sep)] if x.endswith(sep) else x
-                    for x in args if x)
+    return path_sep.join(x[:-len(path_sep)] if x.endswith(path_sep) else x
+                         for x in args if x)
 
 
 def _path_split(path):
diff --git a/Python/importlib.h b/Python/importlib.h
index ad3894d796364f2a220f4de85aae4a9a6141a724..c6c561892fde3e990890ac20ea41bc8e63ba372b
GIT binary patch
[stripped]

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list