Hynek Schlawack  committed e59e274 Draft

#1492704: Ensure and document backward compatibility of the change

  • Participants
  • Parent commits 17a1122

Comments (0)

Files changed (2)

File Doc/library/shutil.rst

       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

File Lib/test/

         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.