#1492704: Backout and wait for 3.4
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 7db9599..a8b9f3f 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -42,9 +42,6 @@
class Error(EnvironmentError):
pass
-class SameFileError(Error):
- """Raised when source and destination are the same file."""
-
class SpecialFileError(EnvironmentError):
"""Raised when trying to do a kind of operation (e.g. copying) which is
not supported on a special file (e.g. a named pipe)"""
@@ -93,7 +90,7 @@
"""
if _samefile(src, dst):
- raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
+ raise Error("`%s` and `%s` are the same file" % (src, dst))
for fn in [src, dst]:
try:
@@ -218,9 +215,6 @@
If follow_symlinks is false, symlinks won't be followed. This
resembles GNU's "cp -P src dst".
- If source and destination are the same file, a SameFileError will be
- raised.
-
"""
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index cbca767..eb0e9a4 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -18,8 +18,7 @@
register_archive_format, unregister_archive_format,
get_archive_formats, Error, unpack_archive,
register_unpack_format, RegistryError,
- unregister_unpack_format, get_unpack_formats,
- SameFileError)
+ unregister_unpack_format, get_unpack_formats)
import tarfile
import warnings
@@ -689,7 +688,7 @@
with open(src, 'w') as f:
f.write('cheddar')
os.link(src, dst)
- self.assertRaises(shutil.SameFileError, shutil.copyfile, src, dst)
+ self.assertRaises(shutil.Error, shutil.copyfile, src, dst)
with open(src, 'r') as f:
self.assertEqual(f.read(), 'cheddar')
os.remove(dst)
@@ -709,7 +708,7 @@
# to TESTFN/TESTFN/cheese, while it should point at
# TESTFN/cheese.
os.symlink('cheese', dst)
- self.assertRaises(shutil.SameFileError, shutil.copyfile, src, dst)
+ self.assertRaises(shutil.Error, shutil.copyfile, src, dst)
with open(src, 'r') as f:
self.assertEqual(f.read(), 'cheddar')
os.remove(dst)
@@ -1216,14 +1215,6 @@
self.assertTrue(os.path.exists(rv))
self.assertEqual(read_file(src_file), read_file(dst_file))
- def test_copyfile_same_file(self):
- # copyfile() should raise SameFileError if the source and destination
- # are the same.
- src_dir = self.mkdtemp()
- src_file = os.path.join(src_dir, 'foo')
- write_file(src_file, 'foo')
- self.assertRaises(SameFileError, shutil.copyfile, src_file, src_file)
-
def test_copytree_return_value(self):
# copytree returns its destination path.
src_dir = self.mkdtemp()