bpo-37609: Update ntpath.splitdrive to use native functionality where possible by zooba · Pull Request #25261 · python/cpython (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change the name to nt._path_splitdrive
, since that makes more sense now that the root is shifted over to the path side. Implement the POSIX fallback as _path_splitdrive
, which only returns str
, just like the builtin function. Move the above bytes support code into a common implementation of ntpath.splitdrive()
, which is likely the only place it will ever be needed. _path_splitdrive()
will be used directly when bytes support isn't required.
I'm sure you know the os.fspath()
call isn't necessary since it's handled for a path_t
argument in C, so why is it called explicitly here?