]> granicus.if.org Git - python/commitdiff
Backport of Guido's review of my patch.
authorChristian Heimes <christian@cheimes.de>
Wed, 7 Nov 2007 18:30:22 +0000 (18:30 +0000)
committerChristian Heimes <christian@cheimes.de>
Wed, 7 Nov 2007 18:30:22 +0000 (18:30 +0000)
Python/import.c

index 265afb951b9e93866a59cbb55747d0b94e63a984..6a4d22f6e645ef4e26a37c48bc23edf50bd62f7f 100644 (file)
@@ -2996,12 +2996,12 @@ NullImporter_init(NullImporter *self, PyObject *args, PyObject *kwds)
                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 @@ NullImporter_init(NullImporter *self, PyObject *args, PyObject *kwds)
                        mangled[pathlen-1] = '\0';
                        rv = stat(mangled, &statbuf);
                }
-#else
-               rv = stat(path, &statbuf);
 #endif
                if (rv == 0) {
                        /* it exists */