From: Georg Brandl Date: Sat, 25 Aug 2012 08:12:47 +0000 (+0200) Subject: merge with 3.2 X-Git-Tag: v3.3.0rc1~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cc0274b90f8c6811c62c89190aafecbd49a15cd8;p=thirdparty%2FPython%2Fcpython.git merge with 3.2 --- cc0274b90f8c6811c62c89190aafecbd49a15cd8 diff --cc Lib/shutil.py index a8b9f3f4cbb3,ef29ae2303c2..5dc311e70dd8 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@@ -332,13 -236,27 +332,13 @@@ def copytree(src, dst, symlinks=False, # Copying file access times may fail on Windows pass else: - errors.extend((src, dst, str(why))) + errors.append((src, dst, str(why))) if errors: raise Error(errors) + return dst -def rmtree(path, ignore_errors=False, onerror=None): - """Recursively delete a directory tree. - - If ignore_errors is set, errors are ignored; otherwise, if onerror - is set, it is called to handle the error with arguments (func, - path, exc_info) where func is os.listdir, os.remove, or os.rmdir; - path is the argument to that function that caused it to fail; and - exc_info is a tuple returned by sys.exc_info(). If ignore_errors - is false and onerror is None, an exception is raised. - - """ - if ignore_errors: - def onerror(*args): - pass - elif onerror is None: - def onerror(*args): - raise +# version vulnerable to race conditions +def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669