]> granicus.if.org Git - python/commitdiff
#3134: shutil referenced undefined WindowsError symbol
authorGeorg Brandl <georg@python.org>
Tue, 12 Aug 2008 08:39:33 +0000 (08:39 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 12 Aug 2008 08:39:33 +0000 (08:39 +0000)
(backport from r65644)

Lib/shutil.py
Misc/NEWS

index c3ff687bff4efcd407f16cddbf71995f7d8962b2..f30ba86483cd063e2122d51a014a12e4df3f45c8 100644 (file)
@@ -15,6 +15,11 @@ __all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2",
 class Error(EnvironmentError):
     pass
 
+try:
+    WindowsError
+except NameError:
+    WindowsError = None
+
 def copyfileobj(fsrc, fdst, length=16*1024):
     """copy data from file-like object fsrc to file-like object fdst"""
     while 1:
@@ -129,11 +134,12 @@ def copytree(src, dst, symlinks=False):
             errors.extend(err.args[0])
     try:
         copystat(src, dst)
-    except WindowsError:
-        # can't copy file access times on Windows
-        pass
     except OSError, why:
-        errors.extend((src, dst, str(why)))
+        if WindowsError is not None and isinstance(why, WindowsError):
+            # Copying file access times may fail on Windows
+            pass
+        else:
+            errors.extend((src, dst, str(why)))
     if errors:
         raise Error, errors
 
index c8d45108b1d6200c623305e17749e4cd969f1af9..79e7d41d5622b2d6b9c022f79f4eb32e1a7af9fc 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,6 +77,8 @@ Core and builtins
 Library
 -------
 
+- Issue #3134: shutil referenced undefined WindowsError symbol.
+
 - Issue #1342811: Fix leak in Tkinter.Menu.delete. Commands associated to
   menu entries were not deleted.