You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is essentially the same problem as that reported in
bug 494904 for pickle: deepcopy should treat instances
of custom metaclasses the same way it treats
instances of type 'type'. I've attached a provisional fix
which is basically a copy of the patch made to pickle (it
checks to see if the type of the thing being deepcopied
is a subclass of type).
One question: it seems to me that the exception
handling code is unnecessary both here and in the
pickle module. In both cases, the first parameter to
subclass is the result of a call to 'type' and the second
is type 'type' itself, so it doesn't seem like there's any
reason to worry about a TypeError.
I changed the patch so that issubclass is called before the
attempt to access __deepcopy__ (to avoid unbound instance
method problem methioned in 494904).
Activity
glchapman commentedon May 26, 2002
This is essentially the same problem as that reported in
bug 494904 for pickle: deepcopy should treat instances
of custom metaclasses the same way it treats
instances of type 'type'. I've attached a provisional fix
which is basically a copy of the patch made to pickle (it
checks to see if the type of the thing being deepcopied
is a subclass of type).
One question: it seems to me that the exception
handling code is unnecessary both here and in the
pickle module. In both cases, the first parameter to
subclass is the result of a call to 'type' and the second
is type 'type' itself, so it doesn't seem like there's any
reason to worry about a TypeError.
glchapman commentedon May 26, 2002
Logged In: YES
user_id=86307
I changed the patch so that issubclass is called before the
attempt to access __deepcopy__ (to avoid unbound instance
method problem methioned in 494904).
gvanrossum commentedon Jun 10, 2002
Logged In: YES
user_id=6380
Thanks; I've checked this in. For the reason of the except
clause, see python.org/sf/502085.