Message367143
> `os.path.abspath(".")` returned
> `'c:\\Users\\Kagami\\Documents\\GitHub\\gecko-dev'`.
> Should `ntpath.normpaoh` make the drive letter uppercase?
ntpath.abspath and ntpath.normpath should preserve the input case for all components of a path because they don't query the system for the real path. On the other hand, ntpath.realpath in 3.8+ opens the path and queries the final path from the system.
With drive-relative paths, ntpath.abspath does upper-case the drive letter. That's due to the underlying GutFullPathNameW call on Windows (an API function that normalizes a path as a string-only operation). We should just leave that up to Windows instead of trying to impose consistency. The behavior could be documented, however, along with other Windows behaviors such as per-drive working directories with drive-relative paths, DOS devices (e.g. "C:/Temp/con.txt" -> r"\\.\con") and stripping of trailing dots and spaces (e.g. "C:/Temp/spam. . ." -> r"C:\Temp\spam"). These cases make ntpath.abspath(path) more complicated than just the documented equivalent of ntpath.normpath(ntpath.join(os.getcwd(), path))` on "most platforms" (i.e. most POSIX platforms -- not Windows). |
|
Date |
User |
Action |
Args |
2020-04-23 20:10:43 | eryksun | set | recipients:
+ eryksun, saschanaz |
2020-04-23 20:10:43 | eryksun | set | messageid: <1587672643.77.0.719381619137.issue40368@roundup.psfhosted.org> |
2020-04-23 20:10:43 | eryksun | link | issue40368 messages |
2020-04-23 20:10:43 | eryksun | create | |
|