[issue19364] Implementing __getattr__ breaks copy and deepcopy

2013-10-24 Thread Eric Snow
Eric Snow added the comment: I knew this sounded familiar. Take a look at issue16251. -- resolution: -> duplicate stage: -> committed/rejected status: open -> closed superseder: -> pickle special methods are looked up on the instance rather than the type ___

[issue19364] Implementing __getattr__ breaks copy and deepcopy

2013-10-24 Thread Kassym Dorsel
Kassym Dorsel added the comment: Yes. You're correct. Sorry for the confusion. Below is an updated snippet of code. >>> from copy import copy >>> class foo(): ... def __getattr__(self, attr): ... return None ... >>> f = foo() >>> copy(f) Traceback (most recent call last): File "", line

[issue19364] Implementing __getattr__ breaks copy and deepcopy

2013-10-23 Thread Eric Snow
Eric Snow added the comment: Your example worked correctly, since the copy module is indeed not copiable. :) Did you mean "from copy import copy"? -- nosy: +eric.snow ___ Python tracker __

[issue19364] Implementing __getattr__ breaks copy and deepcopy

2013-10-23 Thread Kassym Dorsel
New submission from Kassym Dorsel: When __getattr__ is implemented without also implementing __copy__ and __deepcopy__ trying to (deep)copy the class fails. >>> import copy >>> class foo(): ... def __getattr__(self, attr): ... return None ... >>> f = foo() >>> copy(f) Traceback (most rece