]> granicus.if.org Git - python/commitdiff
Should fix the issue19081 fix on Windows. Don't let the previous
authorGregory P. Smith <greg@krypto.org>
Tue, 7 Jan 2014 09:11:09 +0000 (01:11 -0800)
committerGregory P. Smith <greg@krypto.org>
Tue, 7 Jan 2014 09:11:09 +0000 (01:11 -0800)
posix module ImportError cause the nt module import to fail.

Modules/zipimport.c

index bbfbda956f60294ba7f05c7a97852f35529f1377..f458ec684138c3ee5aa94a4b1f1970e1984891cf 100644 (file)
@@ -1429,9 +1429,10 @@ initzipimport(void)
          * live within a zipped up standard library.  Import the posix or nt
          * builtin that provides the fstat() function we want instead. */
         PyObject *os_like_module;
-        Py_XDECREF(fstat_function);  /* Avoid embedded interpreter leaks. */
+        Py_CLEAR(fstat_function);  /* Avoid embedded interpreter leaks. */
         os_like_module = PyImport_ImportModule("posix");
         if (os_like_module == NULL) {
+            PyErr_Clear();
             os_like_module = PyImport_ImportModule("nt");
         }
         if (os_like_module != NULL) {
@@ -1440,6 +1441,8 @@ initzipimport(void)
         }
         if (fstat_function == NULL) {
             PyErr_Clear();  /* non-fatal, we'll go on without it. */
+            if (Py_VerboseFlag)
+                PySys_WriteStderr("# zipimport unable to use os.fstat().\n");
         }
     }
 }