#3134: shutil referenced undefined WindowsError symbol

This commit is contained in:
Antoine Pitrou 2008-08-11 17:21:36 +00:00
parent 48361f5cbf
commit 9fcd4b3d29
2 changed files with 12 additions and 4 deletions

View File

@ -16,6 +16,11 @@ __all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2",
class Error(EnvironmentError): class Error(EnvironmentError):
pass pass
try:
WindowsError
except NameError:
WindowsError = None
def copyfileobj(fsrc, fdst, length=16*1024): def copyfileobj(fsrc, fdst, length=16*1024):
"""copy data from file-like object fsrc to file-like object fdst""" """copy data from file-like object fsrc to file-like object fdst"""
while 1: while 1:
@ -162,11 +167,12 @@ def copytree(src, dst, symlinks=False, ignore=None):
errors.extend(err.args[0]) errors.extend(err.args[0])
try: try:
copystat(src, dst) copystat(src, dst)
except WindowsError:
# can't copy file access times on Windows
pass
except OSError, why: 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: if errors:
raise Error, errors raise Error, errors

View File

@ -44,6 +44,8 @@ Core and Builtins
Library Library
------- -------
- Issue #3134: shutil referenced undefined WindowsError symbol.
- Issue #1342811: Fix leak in Tkinter.Menu.delete. Commands associated to - Issue #1342811: Fix leak in Tkinter.Menu.delete. Commands associated to
menu entries were not deleted. menu entries were not deleted.