Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.2k
Description
Documentation
The documentation says:
cpython/Doc/library/os.path.rst
Lines 406 to 409 in2fd09b0
Return the canonical path of the specified filename, eliminating any symbolic | |
links encountered in the path (if they are supported by the operating | |
system). On Windows, this function will also resolve MS-DOS (also called 8.3) | |
style names such as ``C:\\PROGRA~1`` to ``C:\\Program Files``. |
So it merely mentions symlink resolution, but not what else it means (if anything).
It does however mention that whatever it does is OS dependent:
cpython/Doc/library/os.path.rst
Lines 416 to 418 in2fd09b0
This function emulates the operating system's procedure for making a path | |
canonical, which differs slightly between Windows and UNIX with respect | |
to how links and subsequent path components interact. |
IMO, it should be clearly documented what it doesor at least:
- what it guarantees to the least (For example will the pathname be absolute? Will it be normalised?)
and/or: - which OS function it’s identical to, like on POSIX where that would probablyrealpath(), and whether there are differences to that
Especially since IMO "canonical" pathname (though I think it has no formal definition, or is there anything in POSIX?) means rather just that there are no symlinks left, i.e. that the file is "reached" by its true (=canonical) name.
But that could still be a relative pathname, and perhaps even one that is not normalised.
Cheers,
Chris.
Linked PRs
Metadata
Metadata
Assignees
Projects
Status