[Python-checkins] cpython: Fix the description of pickle protocol numbers

antoine.pitrou python-checkins at python.org
Tue Jan 21 02:54:01 CET 2014


http://hg.python.org/cpython/rev/0bcf1669912a
changeset:   88597:0bcf1669912a
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Tue Jan 21 02:39:54 2014 +0100
summary:
  Fix the description of pickle protocol numbers

files:
  Doc/library/pickle.rst |  39 ++++++++++--------------------
  1 files changed, 13 insertions(+), 26 deletions(-)


diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst
--- a/Doc/library/pickle.rst
+++ b/Doc/library/pickle.rst
@@ -116,7 +116,9 @@
 generated by :mod:`pickle`.  :mod:`pickletools` source code has extensive
 comments about opcodes used by pickle protocols.
 
-There are currently 4 different protocols which can be used for pickling.
+There are currently 5 different protocols which can be used for pickling.
+The higher the protocol used, the more recent the version of Python needed
+to read the pickle produced.
 
 * Protocol version 0 is the original "human-readable" protocol and is
   backwards compatible with earlier versions of Python.
@@ -184,13 +186,10 @@
    Write a pickled representation of *obj* to the open :term:`file object` *file*.
    This is equivalent to ``Pickler(file, protocol).dump(obj)``.
 
-   The optional *protocol* argument tells the pickler to use the given
-   protocol; supported protocols are 0, 1, 2, 3.  The default protocol is 3; a
-   backward-incompatible protocol designed for Python 3.
-
-   Specifying a negative protocol version selects the highest protocol version
-   supported.  The higher the protocol used, the more recent the version of
-   Python needed to read the pickle produced.
+   The optional *protocol* argument, an integer, tells the pickler to use
+   the given protocol; supported protocols are 0 to :data:`HIGHEST_PROTOCOL`.
+   If not specified, the default is :data:`DEFAULT_PROTOCOL`.  If a negative
+   number is specified, :data:`HIGHEST_PROTOCOL` is selected.
 
    The *file* argument must have a write() method that accepts a single bytes
    argument.  It can thus be an on-disk file opened for binary writing, a
@@ -206,17 +205,8 @@
    Return the pickled representation of the object as a :class:`bytes` object,
    instead of writing it to a file.
 
-   The optional *protocol* argument tells the pickler to use the given
-   protocol; supported protocols are 0, 1, 2, 3 and 4.  The default protocol
-   is 3; a backward-incompatible protocol designed for Python 3.
-
-   Specifying a negative protocol version selects the highest protocol version
-   supported.  The higher the protocol used, the more recent the version of
-   Python needed to read the pickle produced.
-
-   If *fix_imports* is true and *protocol* is less than 3, pickle will try to
-   map the new Python 3 names to the old module names used in Python 2, so
-   that the pickle data stream is readable with Python 2.
+   Arguments *protocol* and *fix_imports* have the same meaning as in
+   :func:`dump`.
 
 .. function:: load(file, \*, fix_imports=True, encoding="ASCII", errors="strict")
 
@@ -292,13 +282,10 @@
 
    This takes a binary file for writing a pickle data stream.
 
-   The optional *protocol* argument tells the pickler to use the given
-   protocol; supported protocols are 0, 1, 2, 3 and 4.  The default protocol
-   is 3; a backward-incompatible protocol designed for Python 3.
-
-   Specifying a negative protocol version selects the highest protocol version
-   supported.  The higher the protocol used, the more recent the version of
-   Python needed to read the pickle produced.
+   The optional *protocol* argument, an integer, tells the pickler to use
+   the given protocol; supported protocols are 0 to :data:`HIGHEST_PROTOCOL`.
+   If not specified, the default is :data:`DEFAULT_PROTOCOL`.  If a negative
+   number is specified, :data:`HIGHEST_PROTOCOL` is selected.
 
    The *file* argument must have a write() method that accepts a single bytes
    argument.  It can thus be an on-disk file opened for binary writing, a

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list