Author kdwyer
Recipients d_kagedal, facundobatista, kdwyer
Date 2007-10-23.20:56:47
SpamBayes Score 0.0258649
Marked as misclassified No
Message-id <1193173008.25.0.296762863738.issue1311@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, it seems that Python 2.5 implements two new functions
Py_GetFileAttributesExA and Py_GetFileAttributesExW in posixmodule.c
within the #ifdef MS_WINDOWS block that may return
ERROR_INVALID_PARAMETER to os.stat, which will percolate WindowsError up
to os.exists():

In both functions we find:

static BOOL WINAPI
Py_GetFileAttributesExA(LPCSTR pszFile, 
		       GET_FILEEX_INFO_LEVELS level,
                       LPVOID pv)
{
	BOOL result;
	LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv;
	/* First try to use the system's implementation, if that is
	   available and either succeeds to gives an error other than
	   that it isn't implemented. */
	check_gfax();
	if (gfaxa) {
		result = gfaxa(pszFile, level, pv);
		if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
			return result;
	}
	/* It's either not present, or not implemented.
	   Emulate using FindFirstFile. */
	if (level != GetFileExInfoStandard) {
		SetLastError(ERROR_INVALID_PARAMETER);
		return FALSE;
...


static BOOL WINAPI
Py_GetFileAttributesExW(LPCWSTR pszFile, 
		       GET_FILEEX_INFO_LEVELS level,
                       LPVOID pv)
{
	BOOL result;
	LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv;
	/* First try to use the system's implementation, if that is
	   available and either succeeds to gives an error other than
	   that it isn't implemented. */
	check_gfax();
	if (gfaxa) {
		result = gfaxw(pszFile, level, pv);
		if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
			return result;
	}
	/* It's either not present, or not implemented.
	   Emulate using FindFirstFile. */
	if (level != GetFileExInfoStandard) {
		SetLastError(ERROR_INVALID_PARAMETER);
		return FALSE;
...

I'm neither a C nor a win32api programmer - can anyone explain the
purpose of this code?
History
Date User Action Args
2007-10-23 20:56:48kdwyersetspambayes_score: 0.0258649 -> 0.0258649
recipients: + kdwyer, facundobatista, d_kagedal
2007-10-23 20:56:48kdwyersetspambayes_score: 0.0258649 -> 0.0258649
messageid: <1193173008.25.0.296762863738.issue1311@psf.upfronthosting.co.za>
2007-10-23 20:56:48kdwyerlinkissue1311 messages
2007-10-23 20:56:47kdwyercreate