Roundup Robot added the comment:
New changeset 68ed5b2ca867 by R David Murray in branch 'default':
#17489: Add explanatory comment that __getstate__ is not called.
http://hg.python.org/cpython/rev/68ed5b2ca867
--
nosy: +python-dev
___
Python tracker
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
resolution: - wont fix
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17489
___
Raymond Hettinger added the comment:
Possibly __getstate__ could be removed. That said, I would feel a sense of
risk in taking it out -- that method has been present for a *very* long time
who knows what might rely on it being there.
--
priority: normal - low
Ramchandra Apte added the comment:
__getstate__ is for pickling instances [0], __reduce__ is for pickling the
object itself [1]
^0 http://docs.python.org/2/library/pickle.html#object.__getstate__
^1 http://docs.python.org/2/library/pickle.html#object.__reduce__
--
nosy: +Ramchandra
Víctor Terrón added the comment:
Ramchandra, that is not the behavior that I am able to reproduce. Please see
the attached example: in the presence of __reduce__(), __getstate__() is not
being called whether the class or an instance its pickled. This is also in
consonance with what is stated
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
assignee: - rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17489
___
___
New submission from Víctor Terrón:
The random.Random class implements both the __getstate__() and __reduce__()
methods. My knowledge of the pickle module is very limited, but apparently this
causes __getstate__() never to get called. Maybe this is a remnant from earlier
code, or are both