Skip to content

Commit aef008e

Browse files
Mark the emulation as a best effort, not a specification
1 parent 6fc1216 commit aef008e

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/ntpath.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,9 @@ def normpath(path):
517517

518518
except ImportError: # not running on Windows - mock up something sensible
519519
def _strip_dots_and_spaces(path):
520-
# As the Windows path normalization does.
520+
# Imitate the trailing dot and space stripping performed by the
521+
# Windows path normalization. This is a best effort, not a
522+
# specification.
521523
if isinstance(path, bytes):
522524
sep = b'\\'
523525
dot = b'.'

Lib/test/test_ntpath.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,7 @@ def test_expanduser(self):
12131213
def test_abspath_dots_and_spaces(self):
12141214
# gh-85681: trailing dots and spaces are stripped from the last
12151215
# component, and a single trailing dot from other components.
1216+
# This is the observed Windows behavior, not a specification.
12161217
tester('ntpath.abspath("C:/spam. . .")', "C:\\spam")
12171218
tester('ntpath.abspath("C:/spam.")', "C:\\spam")
12181219
tester('ntpath.abspath("C:/spam ")', "C:\\spam")

0 commit comments

Comments
 (0)