diff options
author | Georg Brandl <georg@python.org> | 2008-01-20 14:17:42 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-01-20 14:17:42 (GMT) |
commit | 5235398323aeb40c3fda4ad2daea3beebb6ff11f (patch) | |
tree | 9e5be28b182abe13cb1ba64dad171d694517798f /Doc/library/shutil.rst | |
parent | 56112895d69131ee4f34d4e3e9406614313df57f (diff) | |
download | cpython-5235398323aeb40c3fda4ad2daea3beebb6ff11f.zip cpython-5235398323aeb40c3fda4ad2daea3beebb6ff11f.tar.gz cpython-5235398323aeb40c3fda4ad2daea3beebb6ff11f.tar.bz2 |
#1669: don't allow shutil.rmtree() to be called on a symlink.
Diffstat (limited to 'Doc/library/shutil.rst')
-rw-r--r-- | Doc/library/shutil.rst | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index 9f79c0f..267435e 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -101,18 +101,24 @@ copying and removal. For operations on individual files, see also the .. index:: single: directory; deleting - Delete an entire directory tree (*path* must point to a directory). If - *ignore_errors* is true, errors resulting from failed removals will be ignored; - if false or omitted, such errors are handled by calling a handler specified by - *onerror* or, if that is omitted, they raise an exception. - - If *onerror* is provided, it must be a callable that accepts three parameters: - *function*, *path*, and *excinfo*. The first parameter, *function*, is the - function which raised the exception; it will be :func:`os.listdir`, - :func:`os.remove` or :func:`os.rmdir`. The second parameter, *path*, will be - the path name passed to *function*. The third parameter, *excinfo*, will be the - exception information return by :func:`sys.exc_info`. Exceptions raised by - *onerror* will not be caught. + Delete an entire directory tree; *path* must point to a directory (but not a + symbolic link to a directory). If *ignore_errors* is true, errors resulting + from failed removals will be ignored; if false or omitted, such errors are + handled by calling a handler specified by *onerror* or, if that is omitted, + they raise an exception. + + If *onerror* is provided, it must be a callable that accepts three + parameters: *function*, *path*, and *excinfo*. The first parameter, + *function*, is the function which raised the exception; it will be + :func:`os.path.islink`, :func:`os.listdir`, :func:`os.remove` or + :func:`os.rmdir`. The second parameter, *path*, will be the path name passed + to *function*. The third parameter, *excinfo*, will be the exception + information return by :func:`sys.exc_info`. Exceptions raised by *onerror* + will not be caught. + + .. versionchanged:: 2.6 + Explicitly check for *path* being a symbolic link and raise :exc:`OSError` + in that case. .. function:: move(src, dst) |