copy_reg problem - UPDATE! PLEASE READ!

Rainer Deyke root at rainerdeyke.com
Fri Oct 6 00:07:31 EDT 2000


Appearantly copy_reg.pickle only works for types, not classes (despite the
documentation saying otherwise).  I really need this to work for class
instances for two reasons:

  1. It allows me to later replace a class with a C extension type.
  2. It allows me to "merge" objects from different pickles.

I have come up with the following possible solutions:

1. Patch pickle/cPickle to allow this.  This sounds unpleasant to maintain.
Patching pickle can be done at runtime, but patching cPickle requires
modifications in the C source code and recompilation.

2. Move all the classes that require this behavior into C entension types
immediately.  This sounds even more unpleasant.

3. Use the metatype mechanism to create "class instances" which aren't of
InstanceType.  This sounds perversely fun.

Any other ideas or suggestions?


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list