[Python-checkins] CVS: python/dist/src/Misc NEWS,1.362,1.363
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 14 Mar 2002 15:05:57 -0800
Update of /cvsroot/python/python/dist/src/Misc
In directory usw-pr-cvs1:/tmp/cvs-serv27759
Modified Files:
NEWS
Log Message:
"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).
Index: NEWS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
retrieving revision 1.362
retrieving revision 1.363
diff -C2 -d -r1.362 -r1.363
*** NEWS 14 Mar 2002 19:06:01 -0000 1.362
--- NEWS 14 Mar 2002 23:05:54 -0000 1.363
***************
*** 7,10 ****
--- 7,16 ----
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.