Changeset 607 for python


Ignore:
Timestamp:
Dec 11, 2015, 7:20:33 PM (10 years ago)
Author:
dmik
Message:

python: Replace altsep to sep in paths returned by os.path.join.

This makes the returned paths consistent and fixes failures in situations
where the result is further passed to a unix shell (and similar cases).
See #148 for more details.

Location:
python/trunk/Lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk/Lib/os2emxpath.py

    r381 r607  
    3737
    3838    Makes all characters lowercase and all altseps into seps."""
    39     return s.replace('\\', '/').lower()
     39    return s.replace(altsep, sep).lower()
    4040
    4141
     
    4444def join(a, *p):
    4545    """Join two or more pathname components, inserting sep as needed"""
     46
     47    Also replace all altsep chars with sep in the returned string
     48    to make it consistent."""
    4649    path = a
    4750    for b in p:
     
    5255        else:
    5356            path = path + '/' + b
    54     return path
     57    return path.replace(altsep, sep)
    5558
    5659
  • python/trunk/Lib/os2knixpath.py

    r381 r607  
    3838
    3939    Makes all characters lowercase and all altseps into seps."""
    40     return s.replace('\\', '/').lower()
     40    return s.replace(altsep, sep).lower()
    4141
    4242
     
    4444
    4545def join(a, *p):
    46     """Join two or more pathname components, inserting sep as needed"""
     46    """Join two or more pathname components, inserting sep as needed.
     47
     48    Also replaces all altsep chars with sep in the returned string
     49    to make it consistent."""
    4750    path = a
    4851    for b in p:
     
    5356        else:
    5457            path = path + '/' + b
    55     return path
     58    return path.replace(altsep, sep)
    5659
    5760
Note: See TracChangeset for help on using the changeset viewer.