mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
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. ........
This commit is contained in:
parent
38478d8654
commit
1fc0d2b364
4 changed files with 19 additions and 0 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue