[docs] [issue21333] Document recommended exception for objects that shouldn't be pickled

Serhiy Storchaka report at bugs.python.org
Wed Oct 28 13:10:04 EDT 2015


Serhiy Storchaka added the comment:

PicklingError is raised in following cases:

1. Programmical Pickler error (Pickler.__init__() was not called by subclass' __init__()).

2. Due to protocol or implementation limitations: memoizing more than 2**32 objects, saving non-ASCII globals with protocol < 3, etc. Exception type is implementation depended. Sometimes OverflowError or struct.error can be raised instead.

3. When __reduce__/__reduce_ex__ returns invalid value: neither str or tuple, a tuple has wrong size, first tuple element is not a callable, first argument for __newobj__/__newobj_ex__ has no __new__ or doesn't match a type of pickled object, global lookup is failed or doesn't match pickled object, etc.

4. When extension code is not an integer or out of range.

----------
nosy: +serhiy.storchaka

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


More information about the docs mailing list