The documentation for the pickle module states, about the 3rd element of the tuple returned by __reduce__:
----
Optionally, the object’s state, which will be passed to the object’s __setstate__() method as previously described. If the object has no such method then, the value must be a dictionary and it will be added to the object’s __dict__ attribute.
----
This doesn't seem correct to me. It should instead read:
----
Optionally, the object’s state, which will be passed to the object’s __setstate__() method as previously described. If the object has no such method, then the value must be:
- for objects with only __dict__, a dictionary which will be used to update the object’s __dict__ attribute.
- for objects with only __slots__, a tuple of (None, {<__slots__ key>: <value>, ...})
- for objects with both __dict__ and __slots__, a tuple of ({<__dict__ key>: <value>, ...}, {<__slots__ key>: <value>, ...})
----
|