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

Stefan Schwarzer report at bugs.python.org
Wed Apr 23 07:57:14 CEST 2014


New submission from Stefan Schwarzer:

I recently was confused whether to raise a `PicklingError` or `TypeError` in `__getstate__` if objects of my class can't and shouldn't be pickled. [1]

Terry Reedy advised I should use `TypeError`. [2]

I wonder if the `pickle` module documention should explicitly recommend using `TypeError` if a class wants to say that its objects can't be pickled. What do you think?

[1] https://mail.python.org/pipermail/python-list/2014-April/670987.html
[2] https://mail.python.org/pipermail/python-list/2014-April/671002.html

----------
assignee: docs at python
components: Documentation
messages: 217054
nosy: docs at python, sschwarzer
priority: normal
severity: normal
status: open
title: Document recommended exception for objects that shouldn't be pickled
type: enhancement
versions: Python 3.5

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


More information about the docs mailing list