Merged revisions 76571 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76571 | antoine.pitrou | 2009-11-28 16:55:58 +0100 (sam., 28 nov. 2009) | 3 lines
Issue #1515: Enable use of deepcopy() with instance methods. Patch by Robert Collins.
........
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index 2af2109..2df0deb 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -677,6 +677,17 @@
del d
self.assertEqual(len(v), 1)
+ def test_deepcopy_bound_method(self):
+ class Foo(object):
+ def m(self):
+ pass
+ f = Foo()
+ f.b = f.m
+ g = copy.deepcopy(f)
+ self.assertEqual(g.m, g.b)
+ self.assertTrue(g.b.__self__ is g)
+ g.b()
+
def global_foo(x, y): return x+y