summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-08-12 08:39:33 (GMT)
committerGeorg Brandl <georg@python.org>2008-08-12 08:39:33 (GMT)
commit1576bab04203f18b7ce8fdf38aa24c4efbba8b3c (patch)
treec5e944dfa4dab6a0212b14a585ee68ea32da26db /Lib
parent45c33ce62d4d9a70083c4e0197c0af75bbef1fb2 (diff)
downloadcpython-1576bab04203f18b7ce8fdf38aa24c4efbba8b3c.zip
cpython-1576bab04203f18b7ce8fdf38aa24c4efbba8b3c.tar.gz
cpython-1576bab04203f18b7ce8fdf38aa24c4efbba8b3c.tar.bz2
#3134: shutil referenced undefined WindowsError symbol
(backport from r65644)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/shutil.py14
1 files changed, 10 insertions, 4 deletions
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 @@ __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