[Python-checkins] r58906 - python/trunk/Python/import.c

christian.heimes python-checkins at python.org
Wed Nov 7 19:30:22 CET 2007


Author: christian.heimes
Date: Wed Nov  7 19:30:22 2007
New Revision: 58906

Modified:
   python/trunk/Python/import.c
Log:
Backport of Guido's review of my patch.

Modified: python/trunk/Python/import.c
==============================================================================
--- python/trunk/Python/import.c	(original)
+++ python/trunk/Python/import.c	Wed Nov  7 19:30:22 2007
@@ -2996,12 +2996,12 @@
 		struct stat statbuf;
 		int rv;
 
-#ifdef MS_WINDOWS
-		/* MS Windows' stat chokes on paths like C:\\path\\. Try to
-		 * recover *one* time by stripping of a trailing slash or
-		 * back slash. http://bugs.python.org/issue1293
-		 */
 		rv = stat(path, &statbuf);
+#ifdef MS_WINDOWS
+		/* MS Windows stat() chokes on paths like C:\path\. Try to
+		 * recover *one* time by stripping off a trailing slash or
+		 * backslash. http://bugs.python.org/issue1293
+ 		 */
 		if (rv != 0 && pathlen <= MAXPATHLEN &&
 		    (path[pathlen-1] == '/' || path[pathlen-1] == '\\')) {
 			char mangled[MAXPATHLEN+1];
@@ -3010,8 +3010,6 @@
 			mangled[pathlen-1] = '\0';
 			rv = stat(mangled, &statbuf);
 		}
-#else
-		rv = stat(path, &statbuf);
 #endif
 		if (rv == 0) {
 			/* it exists */


More information about the Python-checkins mailing list