greg kochanski ynqmddbrzuopmphonoxacuk hierarchy classes use __getstate____setstate__ wrong version __setstate__ gets called possibly documentation problem goes take two classes b b child construct b pickle unpickle find __setstate__ function called result produced b__getstate__ wrong example follows import pickle p class aobject def __init__self print a__init__ selfa def __getstate__self print a__getstate return selfa def __setstate__self upstate print a__setstate upstate selfa upstate class ba def __init__self b print b__init__ a__init__self selfb b def __getstate__self print b__getstate return a__getstate__self selfb def __setstateself upstate never gets called print b__setstate upstate a__setstate__self upstate0 selfb upstate1 def __repr__self return selfa selfb q b12 print r ploadspdumpsq 0 print q q print r r run python foopy b__init__ a__init__ b__getstate a__getstate a__setstate 1 2 q r traceback recent call last file foopy line 44 print r r file foopy line 37 __repr__ return selfa selfb attributeerror b object attribute b _______________________________________________ pythondev mailing list zvlllneumpythonorg httpmailpythonorgmailmanlistinfopythondev unsubscribe httpmailpythonorgmailmanoptionspythondevpythondev40tangomucom tue 22 jul 2008 081302 0000 pythondev bug pickle protocol involving __setstate__