Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/ntpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,8 @@ def _abspath_fallback(path):
def abspath(path):
"""Return the absolute version of a path."""
try:
return _getfullpathname(path)
except OSError:
return normpath(_getfullpathname(path))
except (OSError, ValueError):
return _abspath_fallback(path)

# realpath is a no-op on systems without islink support
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_ntpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ def test_abspath(self):
tester('ntpath.abspath("")', cwd_dir)
tester('ntpath.abspath(" ")', cwd_dir + "\\ ")
tester('ntpath.abspath("?")', cwd_dir + "\\?")
drive, _ = ntpath.splitdrive(cwd_dir)
tester('ntpath.abspath("/abc/")', drive + "\\abc")

def test_relpath(self):
tester('ntpath.relpath("a")', 'a')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix ``ntpath.abspath`` regression where it didn't remove a trailing
separator on Windows. Patch by Tim Graham.