os__getvolumepathname_impl in Modules/posixmodule.c doesn't directly modify the case. So that leaves WinAPI GetVolumePathNameW as the culprit, but, according to the following test, apparently not in Windows 10.0.17134:
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
path = (ctypes.c_wchar * 4)()
kernel32.GetVolumePathNameW(r'c:\windows', path, 4)
>>> path.value
'c:\\'
On a related note, nowadays we need to be careful to only use a case-insensitive comparison for drive letters and other device names. On account of WSL, recent versions of NTFS support flagging directories as case sensitive [1][2]. For example, a volume may be mounted using a junction in a case-sensitive directory.
[1]: https://blogs.msdn.microsoft.com/commandline/2018/02/28/per-directory-case-sensitivity-and-wsl
[2]: https://blogs.msdn.microsoft.com/commandline/2018/06/14/improved-per-directory-case-sensitivity-support-in-wsl |