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.

classification
Title: __reduce__ API specs for objects with __slots__
Type: behavior Stage:
Components: Documentation Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: crusaderky, docs@python
Priority: normal Keywords:

Created on 2019-09-18 13:50 by crusaderky, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg352728 - (view) Author: Guido Imperiale (crusaderky) * Date: 2019-09-18 13:50
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>, ...})

----
History
Date User Action Args
2022-04-11 14:59:20adminsetgithub: 82395
2019-09-18 13:50:59crusaderkycreate