diff options
author | Gregory P. Smith <greg@krypto.org> | 2014-01-07 09:11:09 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2014-01-07 09:11:09 (GMT) |
commit | ad3e72557ce06cd03a2cb573872fd16552bd8201 (patch) | |
tree | 41afa6590edfd3b511793fe6eb81c35470e5656c /Modules/zipimport.c | |
parent | f5dee4ddbd048cc63a2c149cb3388c41c0e09670 (diff) | |
download | cpython-ad3e72557ce06cd03a2cb573872fd16552bd8201.zip cpython-ad3e72557ce06cd03a2cb573872fd16552bd8201.tar.gz cpython-ad3e72557ce06cd03a2cb573872fd16552bd8201.tar.bz2 |
Should fix the issue19081 fix on Windows. Don't let the previous
posix module ImportError cause the nt module import to fail.
Diffstat (limited to 'Modules/zipimport.c')
-rw-r--r-- | Modules/zipimport.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c index bbfbda9..f458ec6 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -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"); } } } |