summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/importlib/_bootstrap.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index fb233cb..8ed7687 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -63,8 +63,16 @@ def _r_long(int_bytes):
def _path_join(*args):
"""Replacement for os.path.join()."""
- sep = path_sep if args[0][-1:] not in path_separators else args[0][-1]
- return sep.join(x[:-len(path_sep)] if x.endswith(path_sep) else x
+ if len(path_separators) == 1:
+ sep = path_sep
+ else:
+ for c 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)