mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Issue #1515: Enable use of deepcopy() with instance methods. Patch by Robert Collins.
This commit is contained in:
parent
c63392c152
commit
d16f57bf4d
4 changed files with 19 additions and 0 deletions
|
@ -672,6 +672,17 @@ class TestCopy(unittest.TestCase):
|
|||
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.im_self is g)
|
||||
g.b()
|
||||
|
||||
|
||||
def global_foo(x, y): return x+y
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue