diff options
author | Hynek Schlawack <hs@ox.cx> | 2012-07-19 18:23:49 (GMT) |
---|---|---|
committer | Hynek Schlawack <hs@ox.cx> | 2012-07-19 18:23:49 (GMT) |
commit | 77d32833700f6ffc05b04e3838bb52e0bb39e2a9 (patch) | |
tree | 39bed30710637cf1a38048a88090e4571f0446b0 /Doc | |
parent | 7506dab2e8602ac5535aeadd885c18bcc572c236 (diff) | |
download | cpython-77d32833700f6ffc05b04e3838bb52e0bb39e2a9.zip cpython-77d32833700f6ffc05b04e3838bb52e0bb39e2a9.tar.gz cpython-77d32833700f6ffc05b04e3838bb52e0bb39e2a9.tar.bz2 |
#1492704: Make shutil.copyfile() raise a distinct SameFileError
Patch by Atsuo Ishimoto.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/shutil.rst | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index 8ed7e9e..d019137 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -52,7 +52,7 @@ Directory and files operations Copy the contents (no metadata) of the file named *src* to a file named *dst* and return *dst*. *dst* must be the complete target file name; look at :func:`shutil.copy` for a copy that accepts a target directory path. If - *src* and *dst* are the same files, :exc:`Error` is raised. + *src* and *dst* are the same files, :exc:`SameFileError` is raised. The destination location must be writable; otherwise, an :exc:`OSError` exception will be raised. If *dst* already exists, it will be replaced. Special files @@ -67,6 +67,16 @@ Directory and files operations :exc:`IOError` used to be raised instead of :exc:`OSError`. Added *follow_symlinks* argument. Now returns *dst*. + Raise :exc:`SameFileError` instead of :exc:`Error`. + + +.. exception:: SameFileError + + This exception is raised if source and destination in :func:`copyfile` + are the same file. + + .. versionadded:: 3.3 + .. function:: copymode(src, dst, *, follow_symlinks=True) |