#3134: shutil referenced undefined WindowsError symbol
(backport from r65644)
diff --git a/Lib/shutil.py b/Lib/shutil.py
index c3ff687..f30ba86 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -15,6 +15,11 @@
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 @@
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
diff --git a/Misc/NEWS b/Misc/NEWS
index c8d4510..79e7d41 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,6 +77,8 @@
Library
-------
+- Issue #3134: shutil referenced undefined WindowsError symbol.
+
- Issue #1342811: Fix leak in Tkinter.Menu.delete. Commands associated to
menu entries were not deleted.