Comment 1 for bug 84728

Revision history for this message
Alexander Belchenko (bialix) wrote :

Actually os.path.abspath is broken on Windows 98, because it rely on native Win32 API function GetFullPathName. And this function not only don't like '/' in UNC path but also don't support unicode filenames properly. So the best solution so far is to switch to alternate implementation of abspath on win98.
Excerpt from ntpath.py:

# Return an absolute path.
try:
    from nt import _getfullpathname

except ImportError: # not running on Windows - mock up something sensible
    def abspath(path):
        """Return the absolute version of a path."""
        if not isabs(path):
            path = join(os.getcwd(), path)
        return normpath(path)

else: # use native Windows method on Windows
    def abspath(path):
        """Return the absolute version of a path."""

        if path: # Empty path must return current working directory.
            try:
                path = _getfullpathname(path)
            except WindowsError:
                pass # Bad path - return unchanged.
        else:
            path = os.getcwd()
        return normpath(path)

The branch when ImportError occurs should be used on Windows 98 instead of native methods.