On Oct 24, 2007 11:05 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > So, the question is what we should do?:
>
> Before this question can be answered, I think we need to fully
> understand what precisely is happening in 2.4, and what precisely
> is happening in 2.5.
>
> AFAICT, it is *not* the case that Python 2.4 (indirectly) has
> hard-coded the names CON, PRN, NUL etc. in the C library. Instead,
> Python 2.4 *also* relies on kernel32 functions to determine that
> these files "exist".
>
> My question now is what specific kernel32 functions Python 2.4
> calls to determine that NUL is a file; before that question
> is sufficiently answered, I don't think any action should be
> taken.
>


os.path.exist() in win32 just calls os.stat() and decides it doesn't
exist if an error is returned. os.stat() uses the vcrt stat()in 2.4,
but 2.5 implements it directly in terms of win32 api to deal with
limitations in the vcrt implementation.

The hand-rolled stat uses GetFileAttributesEx, which returns 0 for the
special filenames, with an error code of "The parameter is incorrect"
(87), which is why os.path.exists() claims it doesn't exist.

Interestingly, plain old GetFileAttributes() works, and returns
FILE_ATTRIBUTE_ARCHIVE for them.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to