diff options
author | Georg Brandl <georg@python.org> | 2008-01-06 14:27:15 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-01-06 14:27:15 (GMT) |
commit | 183a084da3c60109f072cca734eb78fcc1cf56fc (patch) | |
tree | bb3d08fb27b70a1ff52b83794bcff5c17a2a7e76 /Lib/posixpath.py | |
parent | e2a902c66900d313704da1a0860c0c6e11fbab8a (diff) | |
download | cpython-183a084da3c60109f072cca734eb78fcc1cf56fc.zip cpython-183a084da3c60109f072cca734eb78fcc1cf56fc.tar.gz cpython-183a084da3c60109f072cca734eb78fcc1cf56fc.tar.bz2 |
#1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
Diffstat (limited to 'Lib/posixpath.py')
-rw-r--r-- | Lib/posixpath.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py index ee763ad..ee6d0f2 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -398,4 +398,6 @@ def relpath(path, start=curdir): i = len(commonprefix([start_list, path_list])) rel_list = [pardir] * (len(start_list)-i) + path_list[i:] + if not rel_list: + return curdir return join(*rel_list) |