[New-bugs-announce] [issue1515] deepcopy doesn't copy instance methods

Michael Van Biesbrouck report at bugs.python.org
Thu Nov 29 01:41:00 CET 2007

New submission from Michael Van Biesbrouck:

Currently, using deepcopy on instance methods causes an exception to be
thrown.  This can be fixed by adding one line to copy.py:

d[types.MethodType] = _deepcopy_atomic

This will not make duplicate copies of mutable values referenced within
the instance method (such as its associated instance), but it will be
the same as the handling of other function types (which have the same

messages: 57923
nosy: mlvanbie
severity: normal
status: open
title: deepcopy doesn't copy instance methods
type: behavior
versions: Python 2.5

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list