From 27ddb576f163f732a89111e3e66c2d8d5e43e9e8 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Sun, 28 Oct 2012 13:59:27 +0100 Subject: #1492704: Ensure and document backward compatibility of the change --- Doc/library/shutil.rst | 3 ++- Lib/test/test_shutil.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index ec8cad2..b2efcbd 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -70,7 +70,8 @@ Directory and files operations Now returns *dst*. .. versionchanged:: 3.4 - Raise :exc:`SameFileError` instead of :exc:`Error`. + Raise :exc:`SameFileError` instead of :exc:`Error`. Since the former is + a subclass of the latter, this change is backward compatible. .. exception:: SameFileError diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index cbca767..c3997dc 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -1223,6 +1223,8 @@ class TestShutil(unittest.TestCase): src_file = os.path.join(src_dir, 'foo') write_file(src_file, 'foo') self.assertRaises(SameFileError, shutil.copyfile, src_file, src_file) + # But Error should work too, to stay backward compatible. + self.assertRaises(Error, shutil.copyfile, src_file, src_file) def test_copytree_return_value(self): # copytree returns its destination path. -- cgit v0.12