]> granicus.if.org Git - python/commitdiff
#1492704: Ensure and document backward compatibility of the change
authorHynek Schlawack <hs@ox.cx>
Sun, 28 Oct 2012 12:59:27 +0000 (13:59 +0100)
committerHynek Schlawack <hs@ox.cx>
Sun, 28 Oct 2012 12:59:27 +0000 (13:59 +0100)
Doc/library/shutil.rst
Lib/test/test_shutil.py

index ec8cad25f213155003e04cb4c09ddccf11d52ace..b2efcbdd486c78196be38a8439f70abe7e62287b 100644 (file)
@@ -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
index cbca767a4c30afb6cce9a6aca7f7a03d5acbb186..c3997dc93d2f7684a70106e3852aae7a628f3d4b 100644 (file)
@@ -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.