diff Python/import.c @ 43792:2f04abd13394 legacy-trunk

Backport of Guido's review of my patch.
author Christian Heimes <christian@cheimes.de>
date Wed, 07 Nov 2007 18:30:22 +0000
parents dfb460004cfe
children 4cec0c6392c1
line wrap: on
line diff
--- a/Python/import.c	Wed Nov 07 17:50:54 2007 +0000
+++ b/Python/import.c	Wed Nov 07 18:30:22 2007 +0000
@@ -2996,12 +2996,12 @@
 		struct stat statbuf;
 		int rv;
 
+		rv = stat(path, &statbuf);
 #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);
+		/* 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 */