File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,14 @@ the :mod:`glob` module.)
354354 is raised. If *strict * is ``False ``, the path is resolved as far as possible
355355 and any remainder is appended without checking whether it exists.
356356
357+ .. note ::
358+ This function emulates the operating system's procedure for making a path
359+ canonical, which differs slightly between Windows and UNIX with respect
360+ to how links and subsequent path components interact.
361+
362+ Operating system APIs make paths canonical as needed, so it's not
363+ normally necessary to call this function.
364+
357365 .. versionchanged :: 3.6
358366 Accepts a :term: `path-like object `.
359367
Original file line number Diff line number Diff line change @@ -368,6 +368,9 @@ def test_realpath_symlink_loops(self):
368368 self .assertRaises (OSError , ntpath .realpath , ABSTFN + "1" )
369369 self .assertRaises (OSError , ntpath .realpath , ABSTFN + "2" )
370370 self .assertRaises (OSError , ntpath .realpath , ABSTFN + "1\\ x" )
371+
372+ # Windows eliminates '..' components before resolving links, so the
373+ # following 3 realpath() calls are not expected to raise.
371374 self .assertPathEqual (ntpath .realpath (ABSTFN + "1\\ .." ),
372375 ntpath .dirname (ABSTFN ))
373376 self .assertPathEqual (ntpath .realpath (ABSTFN + "1\\ ..\\ x" ),
You can’t perform that action at this time.
0 commit comments