New submission from Guido Imperiale <[email protected]>:
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>, ...})
----
----------
assignee: docs@python
components: Documentation
messages: 352728
nosy: crusaderky, docs@python
priority: normal
severity: normal
status: open
title: __reduce__ API specs for objects with __slots__
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38214>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com