[Python-checkins] cpython: #1492704: Ensure and document backward compatibility of the change
hynek.schlawack
python-checkins at python.org
Sun Oct 28 14:00:36 CET 2012
http://hg.python.org/cpython/rev/e59e274551e0
changeset: 80033:e59e274551e0
parent: 80031:17a1122625ba
user: Hynek Schlawack <hs at ox.cx>
date: Sun Oct 28 13:59:27 2012 +0100
summary:
#1492704: Ensure and document backward compatibility of the change
files:
Doc/library/shutil.rst | 3 ++-
Lib/test/test_shutil.py | 2 ++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst
--- a/Doc/library/shutil.rst
+++ b/Doc/library/shutil.rst
@@ -70,7 +70,8 @@
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
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -1223,6 +1223,8 @@
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.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list