Changeset 1257 for python


Ignore:
Timestamp:
Nov 17, 2017, 12:15:58 PM (8 years ago)
Author:
dmik
Message:

python: Fix handling drive letters in urllib.url2pathname and pathname2url on OS/2.

It used to use Posix code path that would not recongize drive letters and treat the
path as non-absolute. Fixes Mozilla's python/mozbuild/mozpack/test/test_mozjar.py.

File:
1 edited

Legend:

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

    r391 r1257  
    5050elif os.name == 'riscos':
    5151    from rourl2path import url2pathname, pathname2url
     52elif os.name == 'os2':
     53    import nturl2path
     54    def url2pathname(pathname):
     55        """OS-specific conversion from a relative URL of the 'file' scheme
     56        to a file system path; not recommended for general use."""
     57        # nturl2path only expects back slashes
     58        return nturl2path.url2pathname(pathname.replace('/', '\\'))
     59
     60    def pathname2url(pathname):
     61        """OS-specific conversion from a file system path to a relative URL
     62        of the 'file' scheme; not recommended for general use."""
     63        # nturl2path only expects back slashes
     64        return nturl2path.pathname2url(pathname.replace('/', '\\'))
    5265else:
    5366    def url2pathname(pathname):
Note: See TracChangeset for help on using the changeset viewer.