[issue10701] Error pickling objects with mutating __getstate__

Raymond Hettinger report at bugs.python.org
Mon Feb 20 23:07:46 EST 2017


Raymond Hettinger added the comment:

I agree with Antoine that, "As the name suggests, __getstate__ should probably not mutate anything."

Unless a problematic non-mutating example can be found, I suggest this be closed.  For the most part, our rule has been that pure python code doesn't have to (and possibly cannot) defend itself against mid-stream mutation, while C code only has to defend itself to the point of avoiding a segfault.  

IMO, "RuntimeError: dictionary changed size during iteration" is an informative error message in this case.

----------
nosy: +rhettinger
status: pending -> open

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10701>
_______________________________________


More information about the Python-bugs-list mailing list