aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/copy.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/copy.py')
-rw-r--r--Lib/copy.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/copy.py b/Lib/copy.py
index 4b755112d79..089d101c7ca 100644
--- a/Lib/copy.py
+++ b/Lib/copy.py
@@ -239,6 +239,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.