[Python-checkins] python/nondist/peps pep-0307.txt,1.12,1.13

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Thu, 06 Feb 2003 12:35:03 -0800


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1:/tmp/cvs-serv6890

Modified Files:
	pep-0307.txt 
Log Message:
Minor edits to the "Protocol versions" section.


Index: pep-0307.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0307.txt,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** pep-0307.txt	6 Feb 2003 20:29:21 -0000	1.12
--- pep-0307.txt	6 Feb 2003 20:35:00 -0000	1.13
***************
*** 60,86 ****
  Protocol versions
  
!     Previously, pickling (but not unpickling) has distinguished
!     between text mode and binary mode.  By design, text mode is a
!     subset of binary mode, and unpicklers don't need to know in
      advance whether an incoming pickle uses text mode or binary mode.
      The virtual machine used for unpickling is the same regardless of
!     the mode; certain opcode simply aren't used in text mode.
  
!     Retroactively, text mode is called protocol 0, and binary mode is
!     called protocol 1.  The new protocol is called protocol 2.  In the
      tradition of pickling protocols, protocol 2 is a superset of
      protocol 1.  But just so that future pickling protocols aren't
      required to be supersets of the oldest protocols, a new opcode is
      inserted at the start of a protocol 2 pickle indicating that it is
!     using protocol 2.
  
      Several functions, methods and constructors used for pickling used
      to take a positional argument named 'bin' which was a flag,
      defaulting to 0, indicating binary mode.  This argument is renamed
!     to 'proto' and now gives the protocol number, defaulting to 0.
  
      It so happens that passing 2 for the 'bin' argument in previous
      Python versions had the same effect as passing 1.  Nevertheless, a
!     special case is added here: passing a negative number selects the
      highest protocol version supported by a particular implementation.
      This works in previous Python versions, too.
--- 60,89 ----
  Protocol versions
  
!     Previously, pickling (but not unpickling) distinguished between
!     text mode and binary mode.  By design, binary mode is a
!     superset of text mode, and unpicklers don't need to know in
      advance whether an incoming pickle uses text mode or binary mode.
      The virtual machine used for unpickling is the same regardless of
!     the mode; certain opcodes simply aren't used in text mode.
  
!     Retroactively, text mode is now called protocol 0, and binary mode
!     protocol 1.  The new protocol is called protocol 2.  In the
      tradition of pickling protocols, protocol 2 is a superset of
      protocol 1.  But just so that future pickling protocols aren't
      required to be supersets of the oldest protocols, a new opcode is
      inserted at the start of a protocol 2 pickle indicating that it is
!     using protocol 2.  To date, each release of Python has been able to
!     read pickles written by all previous releases.  Of course pickles
!     written under protocol N can't be read by versions of Python
!     earlier than the one that introduced protocol N.
  
      Several functions, methods and constructors used for pickling used
      to take a positional argument named 'bin' which was a flag,
      defaulting to 0, indicating binary mode.  This argument is renamed
!     to 'proto' and now gives the protocol number, still defaulting to 0.
  
      It so happens that passing 2 for the 'bin' argument in previous
      Python versions had the same effect as passing 1.  Nevertheless, a
!     special case is added here:  passing a negative number selects the
      highest protocol version supported by a particular implementation.
      This works in previous Python versions, too.