Manuel de la Pena <[email protected]> added the comment:
Antoine,
What the MSDN is stating is that the Windows functions from COM will not
normalize the path if it is prefixed by \\?\. That is, if a user wanted to do:
path = r'\\?\C:\Users\mandel\..\Desktop\test'
with open(path, 'w') as fd:
fd.write('hello!')
he will get the following:
[Errorno 22] Invalid argument. r'\\?\C:\Users\mandel\..\Desktop\test'
The same think would happen if a C function is used, that is, open is doing the
right thing. On the other hand, the same code without the \\?\ works.
This makes it even more important to allow the normpath users to normalize such
paths, that is, a developer knows that the path has more than 260 chars and
wants to make sure that the path can be written in the system:
May I ask you why you mention the symbolic links? I know that if one of the
segments of the path is a symbolic link there are problems but this is not
related to \\?\ or am I confused? Just curious :)
Brian,
The ntpath module is a little mess (look at my other patch
http://bugs.python.org/issue15275) and I think there are more performance
problems hidden there somewhere...
I imported string within the function because the same is done in expandvars
(around line 430) and wanted to follow the style that was already in use in the
file. I do agree that imports at the top are the way to go :)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15286>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com