Eryk Sun <[email protected]> added the comment:
If you want to harden the test for Windows, you could transform TEMPDIR
into an extended path. os.path._getfinalpathname always returns an extended
path. For example:
>>> os.path._getfinalpathname('C:/Temp')
'\\\\?\\C:\\Temp'
>>> os.path._getfinalpathname('//localhost/C$/Temp')
'\\\\?\\UNC\\localhost\\C$\\Temp'
> windows.RtlAreLongPathsEnabled: <function not available>
>
> RtlAreLongPathsEnabled() is not available on Windows 8.1. I don't
> know if long paths support is enabled or not on this buildbot (I
> guess that no, it isn't).
Normalized long paths are implemented in Windows 10 1607 and later. Previous
versions do not have RtlAreLongPathsEnabled and cannot support normalized long
paths. RtlAreLongPathsEnabled() will be true if, at process startup, the
"LongPathsEnabled" policy is enabled in the registry and the application
manifest claims to be "longPathAware".
In all supported versions of Windows, long paths are supported by most
filesystem functions if we use an extended path, i.e. a fully-qualified Unicode
path that starts with the \\?\ prefix. This path type is not normalized in a
create or open context, so it can only use backslash as the path separator, not
forward slash. Also, the process working directory does not allow extended
paths, so when using extended paths we have to manage our own working directory
and manually resolve relative paths, including "." and ".." components (e.g. by
calling GetFullPathNameW).
----------
nosy: +eryksun
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37528>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com