[Python-checkins] python/dist/src/Lib shutil.py,1.26,1.27
bwarsaw@users.sourceforge.net
bwarsaw@users.sourceforge.net
Fri, 24 Jan 2003 09:36:17 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv18409
Modified Files:
shutil.py
Log Message:
rmtree(): Make implementation agree with documentation (both latex and
docstring). Even if ignore_errors was true, an exception would occur
if path didn't exist.
Index: shutil.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/shutil.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** shutil.py 5 Jan 2003 19:44:11 -0000 1.26
--- shutil.py 24 Jan 2003 17:36:15 -0000 1.27
***************
*** 118,122 ****
raise Error, errors
! def rmtree(path, ignore_errors=0, onerror=None):
"""Recursively delete a directory tree.
--- 118,122 ----
raise Error, errors
! def rmtree(path, ignore_errors=False, onerror=None):
"""Recursively delete a directory tree.
***************
*** 124,142 ****
onerror is set, it is called to handle the error; otherwise, an
exception is raised.
-
"""
cmdtuples = []
! _build_cmdtuple(path, cmdtuples)
! for func, arg in cmdtuples:
! try:
func(arg)
! except OSError:
! exc = sys.exc_info()
! if ignore_errors:
! pass
! elif onerror is not None:
! onerror(func, arg, exc)
! else:
! raise exc[0], (exc[1][0], exc[1][1] + ' removing '+arg)
# Helper for rmtree()
--- 124,142 ----
onerror is set, it is called to handle the error; otherwise, an
exception is raised.
"""
cmdtuples = []
! arg = path
! try:
! _build_cmdtuple(path, cmdtuples)
! for func, arg in cmdtuples:
func(arg)
! except OSError:
! exc = sys.exc_info()
! if ignore_errors:
! pass
! elif onerror is not None:
! onerror(func, arg, exc)
! else:
! raise exc[0], (exc[1][0], exc[1][1] + ' removing '+arg)
# Helper for rmtree()