Index: Doc/library/os.path.rst =================================================================== --- Doc/library/os.path.rst (revision 77150) +++ Doc/library/os.path.rst (working copy) @@ -218,12 +218,12 @@ links encountered in the path (if they are supported by the operating system). -.. function:: relpath(path, start=None) +.. function:: relpath(path, start=os.curdir) Return a relative filepath to *path* either from the current directory or from an optional *start* point. - *start* defaults to :attr:`os.curdir`. Availability: Windows, Unix. + Availability: Windows, Unix. .. function:: samefile(path1, path2) Index: Lib/posixpath.py =================================================================== --- Lib/posixpath.py (revision 77150) +++ Lib/posixpath.py (working copy) @@ -423,7 +423,7 @@ supports_unicode_filenames = False -def relpath(path, start=None): +def relpath(path, start=curdir): """Return a relative version of a path""" if not path: @@ -433,14 +433,14 @@ curdir = b'.' sep = b'/' pardir = b'..' + # If start is the str of curdir (default), set it to bytes + if start == curdir.decode(sys.getfilesystemencoding()): + start = curdir else: curdir = '.' sep = '/' pardir = '..' - if start is None: - start = curdir - start_list = abspath(start).split(sep) path_list = abspath(path).split(sep)