This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Arfrever, amaury.forgeotdarc, eric.araujo, ezio.melotti, pitrou, vstinner
Date 2010-08-09.00:39:28
SpamBayes Score 9.36098e-10
Marked as misclassified No
Message-id <>
_Py_stat.patch: create _Py_stat() function. It will be used in import.c and zipimport.c.

I added the function to import.c because, initially, I only used it there. But it's maybe not the best place for such function. posixmodule.c doesn't fit because it is not part of the bootstrap process.

I created this function to get full unicode support on Windows (don't fallback to bytes using the evil mbcs encoding).

In import.c and zipimport.c, it is used to check if the path is a regular file or if the path is a directory. That's why _Py_stat() only fills st_mode attribute (it's just enough).

A better API would be maybe functions checking directly these properties? Maybe Py_isdir() (as os.path.isdir()) and Py_isreg()? Or if you prefer longer names: Py_is_directory() ad Py_is_regular_file()? Such functions can be implemented differently, eg. use GetFileAttributesW on Windows. I say that because of a comment found in NullImporter_init():

    /* see issue1293 and issue3677:
     * stat() on Windows doesn't recognise paths like
     * "e:\\shared\\" and "\\\\whiterab-c2znlh\\shared" as dirs.
Date User Action Args
2010-08-09 00:39:34vstinnersetrecipients: + vstinner, amaury.forgeotdarc, pitrou, ezio.melotti, eric.araujo, Arfrever
2010-08-09 00:39:34vstinnersetmessageid: <>
2010-08-09 00:39:32vstinnerlinkissue9425 messages
2010-08-09 00:39:31vstinnercreate