The shutil.rmtree() library function promises to ignore
or handle
exceptions if the optional `ignore_errors' or
`onerrror' parameters
are passed, respectively.
However, if you invoke rmtree() on a non-existent path, the
exception is not caught within the exception-handling
block,
and so the exception is not ignored or handled even if
the caller
passed ignore_error or onerror.
The problem is due to the fact that the helper function
_build_cmdtuples() is called from outside the
exception-handling
block. This patch rearranges rmtree() a bit, so that
exceptions from
_build_cmdtuples() are handled too.
The log message is included in the attached patch, and also
here for convenience:
2002-06-09 Karl Fogel <kfogel@collab.net>
* python/dist/src/Lib/shutil.py
(rmtree): Place _build_cmdtuple within the
try/except too.
* python/dist/src/Doc/lib/libshutil.tex
(rmtree): Don't promise that errors will come only
from os.remove
or os.rmdir anymore, since the exception catching is
now expanded.
I generated the patch against the Python CVS tree of
Sunday,
9 June 2002.
|