[issue35933] python doc does not say that the state kwarg in Pickler.save_reduce can be a tuple (and not only a dict)

Pierre Glaser report at bugs.python.org
Thu Feb 7 12:55:23 EST 2019


New submission from Pierre Glaser <pierreglaser at msn.com>:

Hello all,
This 16-year old commit (*) allows an object's state to be updated
using its slots instead of its __dict__ at unpickling time. To use this
functionality, the state keyword-argument of Pickler.save_reduce (which maps to
the third item of the tuple returned by __reduce__) should be a length-2 tuple.
As far as I can tell, this is not mentioned in the documentation (**). I suggest having the docs updated. What do you think?

(*) https://github.com/python/cpython/commit/ac5b5d2e8b849c499d323b0263ace22e56b4f0d9
(**) https://docs.python.org/3.8/library/pickle.html#object.__reduce__

----------
assignee: docs at python
components: Documentation
messages: 335031
nosy: alexandre.vassalotti, docs at python, pierreglaser, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: python doc does not say that the state kwarg in Pickler.save_reduce can be a tuple (and not only a dict)
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35933>
_______________________________________


More information about the Python-bugs-list mailing list