Eryk Sun <eryk...@gmail.com> added the comment:

> `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).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40368>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to