diff options
author | Ćukasz Langa <lukasz@langa.pl> | 2018-04-04 06:06:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-04 06:06:53 (GMT) |
commit | c51d8c9ba6211d77db639487501f89aa9b4bcbb1 (patch) | |
tree | cabc297cea85143550c1755cbd9a19ec9c2c2603 /Lib | |
parent | 42ec190761a2e8503aaa06f0bfaaabe98749179b (diff) | |
download | cpython-c51d8c9ba6211d77db639487501f89aa9b4bcbb1.zip cpython-c51d8c9ba6211d77db639487501f89aa9b4bcbb1.tar.gz cpython-c51d8c9ba6211d77db639487501f89aa9b4bcbb1.tar.bz2 |
bpo-23403: Bump pickle.DEFAULT_PROTOCOL to 4 (#6355)
This makes performance better and produces shorter pickles. This change is backwards compatible up to the oldest currently supported version of Python (3.4).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/pickle.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py index e6d0037..b852fbd 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -57,9 +57,9 @@ compatible_formats = ["1.0", # Original protocol 0 HIGHEST_PROTOCOL = 4 # The protocol we write by default. May be less than HIGHEST_PROTOCOL. -# We intentionally write a protocol that Python 2.x cannot read; -# there are too many issues with that. -DEFAULT_PROTOCOL = 3 +# Only bump this if the oldest still supported version of Python already +# includes it. +DEFAULT_PROTOCOL = 4 class PickleError(Exception): """A common base class for the other pickling exceptions.""" @@ -376,8 +376,8 @@ class _Pickler: 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. + default protocol is 4. It was introduced in Python 3.4, it is + incompatible with previous versions. Specifying a negative protocol version selects the highest protocol version supported. The higher the protocol used, the |