diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-11-28 15:58:27 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-11-28 15:58:27 (GMT) |
commit | 1fc0d2b364b144e501615cf82e998beb87733607 (patch) | |
tree | c1c1c81def7ee308624314b0367b9845d969e0a0 /Lib/copy.py | |
parent | 38478d8654115de4f3d1964b59f892deebbdb728 (diff) | |
download | cpython-1fc0d2b364b144e501615cf82e998beb87733607.zip cpython-1fc0d2b364b144e501615cf82e998beb87733607.tar.gz cpython-1fc0d2b364b144e501615cf82e998beb87733607.tar.bz2 |
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.
........
Diffstat (limited to 'Lib/copy.py')
-rw-r--r-- | Lib/copy.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/copy.py b/Lib/copy.py index 2646350..789488c 100644 --- a/Lib/copy.py +++ b/Lib/copy.py @@ -238,6 +238,10 @@ d[dict] = _deepcopy_dict if PyStringMap is not None: d[PyStringMap] = _deepcopy_dict +def _deepcopy_method(x, memo): # Copy instance methods + return type(x)(x.__func__, deepcopy(x.__self__, memo)) +_deepcopy_dispatch[types.MethodType] = _deepcopy_method + def _keep_alive(x, memo): """Keeps a reference to the object x in the memo. |