Alexandre Vassalotti added the comment:
The mutating __getstate__ is very likely the problem here. I've attached a
small test case which shows the described behavior.
We could fix this by always making a copy of any mutable container we want to
iterate over to save its items. Performance-wise
Charles-François Natali added the comment:
> It's interesting. The example behaves unstable on 3.3+ with C implementation
> of picle, sometimes works, sometimes fails. With Python implementation and on
> 3.2 it works always. On 2.7 it fails always.
That's hash randomization.
--
nosy:
Antoine Pitrou added the comment:
I find the posted code mystifying. As the name suggests, __getstate__ should
probably not mutate anything.
It would be nice if you could post a simpler example to reproduce issue. Even
better if it doesn't have a mutating __getstate__, I would say.
--
Serhiy Storchaka added the comment:
It's interesting. The example behaves unstable on 3.3+ with C implementation of
picle, sometimes works, sometimes fails. With Python implementation and on 3.2
it works always. On 2.7 it fails always.
A difference between C and Python implementations of pickl
New submission from Alexander Belopolsky :
The work-around that I proposed for issue10700 does not work with Python 2.x:
$ python2.7 dict-graph.py
Vertex 0 -> 2, 1
Vertex 1 ->
Vertex 2 ->
Traceback (most recent call last):
File "dict-graph.py", line 74, in
p = pickle.dumps(g)
...
Fi