Skip to content
Commit 936e1403 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Fix pickling

This fixes two issues.

- First, __getinitargs__ does not actually get called for new-style
  classes. Whoops. Only __getstate__ and __setstate__ do. This
  introduces a version of these methods that relies on a new class
  attribute init_arg_names and the existing __getinitargs__ methods
  to provide pickling.

- The default implementation of __getstate__ would pickle up the cached
  hash_value, which will likely be different in a new interpreter.
  Bad idea, fixed as above.
parent ad04892c
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment