On 8/21/2016 9:08 PM, eryk sun 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.

Since the function is there, please consider opening an issue and submitting a patch to improve it. Also, could the doc be improved to say that is_reserved() == False might be wrong? It is possible to broaden the test so that too many names, rather than too, are marked as reserved? Better to say "don't use" for a good name rather than 'use' for a reserved name.

--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to