On Mon, Aug 22, 2016 at 11:08 AM, eryk sun <eryk...@gmail.com> wrote: > On Mon, Aug 22, 2016 at 12:44 AM, Chris Angelico <ros...@gmail.com> wrote: >> "Trying to be" cross-platform? The point of these path modules is to >> *be* cross-platform. I can't call Windows APIs on my Linux box (short >> of messing around with VMs or Wine or something, which are >> dependencies that Python doesn't need). So yes, these *are* >> cross-platform, and that's not scary, that's deliberate design. > > Sorry for the wording SNAFU there. Of course it's cross-platform. But > I think it's a dubious check. On Windows itself I would never try what > it's attempting to do. I would just call GetFullPathName to see if the > path changes to use the \\.\ device namespace. I doubt that the 3 > examples I gave are the only places that this simplistic > implementation of 'is_reserved" fails. It's giving a dangerous > impression to the user that the path will be safe to use on Windows > when that's not the case.
Understood, and apology accepted. But I think it should be understood that this will *not* call any Windows APIs. It's called "PureWindowsPath" and is an example of a pure path: https://docs.python.org/3/library/pathlib.html#pure-paths They're specifically documented as not touching any file system, which means that they are cross-platform and cannot be guaranteed to be perfect. If you know you're running on Windows, use WindowsPath instead (trying to do so on a non-Windows system will cause an immediate exception), and then you can test your examples on that. It may well already probe the file system in that situation, and if not, you could put forward the feature suggestion that it should. But the PurePath classes won't. ChrisA -- https://mail.python.org/mailman/listinfo/python-list