mirror of https://github.com/python/cpython
#3134: shutil referenced undefined WindowsError symbol
(backport from r65644)
This commit is contained in:
parent
45c33ce62d
commit
1576bab042
|
@ -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,10 +134,11 @@ 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:
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue