This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mwm
Recipients mwm
Date 2009-02-25.21:26:11
SpamBayes Score 1.2869705e-12
Marked as misclassified No
Message-id <1235597176.48.0.557535954175.issue5370@psf.upfronthosting.co.za>
In-reply-to
Content
The attached short file causes all of python 2.5, 2.6 and 3.0 to drop
into infinite recursion trying to unpickle the created object, but the
2.5 version has the cleanest The problem appears to be that the unpickle
code (C in 3.0; Python in 2.5 - I assume the others are similar) uses
getattr to try and get the __setstate__ method (if any) of the opject
being built before it's dictionary is populated. This causes the
invocation of the __getattr__ method, which tries to use the
non-existent "attrs" attribute, thus starting the recursion.

A simple workaround is to provide this:

  def __setstate__(self, data):
      self.__dict__.update(data)

but methinks that either 1) the interpreter shouldn't be falling into
the infinite loop in this case, or 2) the pickle code should be using
hasattr to check for the attribute (which won't trigger this problem)
before trying getattr on it.
History
Date User Action Args
2009-02-25 21:26:17mwmsetrecipients: + mwm
2009-02-25 21:26:16mwmsetmessageid: <1235597176.48.0.557535954175.issue5370@psf.upfronthosting.co.za>
2009-02-25 21:26:14mwmlinkissue5370 messages
2009-02-25 21:26:12mwmcreate