[Python-checkins] r73676 - in python/branches/py3k: Modules/posixmodule.c

hirokazu.yamamoto python-checkins at python.org
Mon Jun 29 13:37:19 CEST 2009


Author: hirokazu.yamamoto
Date: Mon Jun 29 13:37:19 2009
New Revision: 73676

Log:
Merged revisions 73675 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73675 | hirokazu.yamamoto | 2009-06-29 20:27:03 +0900 | 3 lines
  
  Issue #4856: Py_GetFileAttributesEx[AW] are not needed because GetFileAttributesEx[AW]
  won't fail with ERROR_CALL_NOT_IMPLEMENTED on win NT.
  Reviewed by Amaury Forgeot d'Arc.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Modules/posixmodule.c

Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c	(original)
+++ python/branches/py3k/Modules/posixmodule.c	Mon Jun 29 13:37:19 2009
@@ -1024,68 +1024,13 @@
 	return TRUE;
 }
 
-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. */
-	result = GetFileAttributesExA(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;
-	}
-	/* Use GetFileAttributes to validate that the file name
-	   does not contain wildcards (which FindFirstFile would
-	   accept). */
-	if (GetFileAttributesA(pszFile) == 0xFFFFFFFF)
-		return FALSE;
-	return attributes_from_dir(pszFile, pfad);
-}
-
-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. */
-	result = GetFileAttributesExW(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;
-	}
-	/* Use GetFileAttributes to validate that the file name
-	   does not contain wildcards (which FindFirstFile would
-	   accept). */
-	if (GetFileAttributesW(pszFile) == 0xFFFFFFFF)
-		return FALSE;
-	return attributes_from_dir_w(pszFile, pfad);
-}
-
 static int 
 win32_stat(const char* path, struct win32_stat *result)
 {
 	WIN32_FILE_ATTRIBUTE_DATA info;
 	int code;
 	char *dot;
-	/* XXX not supported on Win95 and NT 3.x */
-	if (!Py_GetFileAttributesExA(path, GetFileExInfoStandard, &info)) {
+	if (!GetFileAttributesExA(path, GetFileExInfoStandard, &info)) {
 		if (GetLastError() != ERROR_SHARING_VIOLATION) {
 			/* Protocol violation: we explicitly clear errno, instead of
 			   setting it to a POSIX error. Callers should use GetLastError. */
@@ -1122,8 +1067,7 @@
 	int code;
 	const wchar_t *dot;
 	WIN32_FILE_ATTRIBUTE_DATA info;
-	/* XXX not supported on Win95 and NT 3.x */
-	if (!Py_GetFileAttributesExW(path, GetFileExInfoStandard, &info)) {
+	if (!GetFileAttributesExW(path, GetFileExInfoStandard, &info)) {
 		if (GetLastError() != ERROR_SHARING_VIOLATION) {
 			/* Protocol violation: we explicitly clear errno, instead of
 			   setting it to a POSIX error. Callers should use GetLastError. */


More information about the Python-checkins mailing list