diff options
author | Guido van Rossum <guido@python.org> | 2002-03-14 23:05:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-03-14 23:05:54 (GMT) |
commit | 8c8425531638fcab2093639d29c413cdb3bea787 (patch) | |
tree | 2506d03952de8ec487ffd333d4d3f80cc119d177 /Misc | |
parent | 0628dcfe1faac4926505f8c4cb1905d7700d1bf1 (diff) | |
download | cpython-8c8425531638fcab2093639d29c413cdb3bea787.zip cpython-8c8425531638fcab2093639d29c413cdb3bea787.tar.gz cpython-8c8425531638fcab2093639d29c413cdb3bea787.tar.bz2 |
"Fix" for SF bug #520644: __slots__ are not pickled.
As promised in my response to the bug report, I'm not really fixing
it; in fact, one could argule over what the proper fix should do.
Instead, I'm adding a little magic that raises TypeError if you try to
pickle an instance of a class that has __slots__ but doesn't define or
override __getstate__. This is done by adding a bozo __getstate__
that always raises TypeError.
Bugfix candidate (also the checkin to typeobject.c, of course).
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -6,6 +6,12 @@ Type/class unification and new-style classes Core and builtins +- If you try to pickle an instance of a class that has __slots__ but + doesn't define or override __getstate__, a TypeError is now raised. + This is done by adding a bozo __getstate__ to the class that always + raises TypeError. (Before, this would appear to be pickled, but the + state of the slots would be lost.) + - PyErr_Display will provide file and line information for all exceptions that have an attribute print_file_and_line, not just SyntaxErrors. |