Have importlib look for pre-existing path separators when joining
paths.
This commit is contained in:
parent
cb165db3a3
commit
0d05a7698b
|
@ -63,8 +63,16 @@ def _r_long(int_bytes):
|
||||||
|
|
||||||
def _path_join(*args):
|
def _path_join(*args):
|
||||||
"""Replacement for os.path.join()."""
|
"""Replacement for os.path.join()."""
|
||||||
sep = path_sep if args[0][-1:] not in path_separators else args[0][-1]
|
if len(path_separators) == 1:
|
||||||
return sep.join(x[:-len(path_sep)] if x.endswith(path_sep) else x
|
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)
|
for x in args if x)
|
||||||
|
|
||||||
|
|
||||||
|
|
6022
Python/importlib.h
6022
Python/importlib.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue