[Python-checkins] python/nondist/peps pep-0307.txt,1.5,1.6
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Mon, 03 Feb 2003 09:50:21 -0800
Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1:/tmp/cvs-serv12555
Modified Files:
pep-0307.txt
Log Message:
Misc tweaks and updates.
Index: pep-0307.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0307.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pep-0307.txt 1 Feb 2003 20:10:35 -0000 1.5
--- pep-0307.txt 3 Feb 2003 17:50:16 -0000 1.6
***************
*** 27,30 ****
--- 27,36 ----
CVS for Python 2.3).
+ This PEP attempts to fully document the interface between pickled
+ objects and the pickling process, highlighting additions by
+ specifying "new in this PEP". (The interface to invoke pickling
+ or unpickling is not covered fully, except for the changes to the
+ API for specifying the pickling protocol to picklers.)
+
Motivation
***************
*** 79,82 ****
--- 85,97 ----
This works in previous Python versions, too.
+ The pickle.py module has supported passing the 'bin' value as a
+ keyword argument rather than a positional argument. (This is not
+ recommended, since cPickle only accepts positional arguments, but
+ it works...) Passing 'bin' as a keyword argument is deprecated,
+ and a PendingDeprecationWarning is issued in this case. You have
+ to invoke the Python interpreter with -Wa or a variation on that
+ to see PendingDeprecationWarning messages. In Python 2.4, the
+ warning class may be upgraded to DeprecationWarning.
+
Security issues
***************
*** 106,109 ****
--- 121,127 ----
unauthenticated source ***
+ The same warning applies to previous Python versions, despite the
+ presence of safety checks there.
+
Extended __reduce__ API
***************
*** 185,188 ****
--- 203,215 ----
state with value None.
+ A __reduce__ implementation that needs to work both under Python
+ 2.2 and under Python 2.3 could check the variable
+ pickle.format_version to determine whether to use the listitems
+ and dictitems features. If this value is >= "2.0" then they are
+ supported. If not, any list or dict items should be incorporated
+ somehow in the 'state' return value; the __setstate__ method
+ should be prepared to accept list or dict items as part of the
+ state (how this is done is up to the application).
+
The __newobj__ unpickling function
***************
*** 205,208 ****
--- 232,239 ----
function named __newobj__ that returns something different, you
deserve what you get.
+
+ It is safe to use this feature under Python 2.2; there's nothing
+ in the recommended implementation of __newobj__ that depends on
+ Python 2.3.