Skip to content

bpo-39426: Fix outdated default and highest protocols in docs #18154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Lib/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,9 @@ def __init__(self, file, protocol=None, *, fix_imports=True,
"""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 4. It was introduced in Python 3.4, it is
incompatible with previous versions.
given protocol; supported protocols are 0, 1, 2, 3, 4 and 5.
The default protocol is 4. It was introduced in Python 3.4, and
is incompatible with previous versions.

Specifying a negative protocol version selects the highest
protocol version supported. The higher the protocol used, the
Expand Down
19 changes: 10 additions & 9 deletions Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -4645,8 +4645,9 @@ _pickle.Pickler.__init__
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.
protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default
protocol is 4. It was introduced in Python 3.4, and is incompatible
with previous versions.

Specifying a negative protocol version selects the highest protocol
version supported. The higher the protocol used, the more recent the
Expand Down Expand Up @@ -4678,7 +4679,7 @@ static int
_pickle_Pickler___init___impl(PicklerObject *self, PyObject *file,
PyObject *protocol, int fix_imports,
PyObject *buffer_callback)
/*[clinic end generated code: output=0abedc50590d259b input=bb886e00443a7811]*/
/*[clinic end generated code: output=0abedc50590d259b input=a7c969699bf5dad3]*/
{
_Py_IDENTIFIER(persistent_id);
_Py_IDENTIFIER(dispatch_table);
Expand Down Expand Up @@ -7635,8 +7636,8 @@ This is equivalent to ``Pickler(file, protocol).dump(obj)``, but may
be more efficient.

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 4. It was introduced in Python 3.4, it is incompatible
protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default
protocol is 4. It was introduced in Python 3.4, and is incompatible
with previous versions.

Specifying a negative protocol version selects the highest protocol
Expand All @@ -7662,7 +7663,7 @@ static PyObject *
_pickle_dump_impl(PyObject *module, PyObject *obj, PyObject *file,
PyObject *protocol, int fix_imports,
PyObject *buffer_callback)
/*[clinic end generated code: output=706186dba996490c input=cfdcaf573ed6e46c]*/
/*[clinic end generated code: output=706186dba996490c input=5ed6653da99cd97c]*/
{
PicklerObject *pickler = _Pickler_New();

Expand Down Expand Up @@ -7705,8 +7706,8 @@ _pickle.dumps
Return the pickled representation of the object as a bytes object.

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 4. It was introduced in Python 3.4, it is incompatible
protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default
protocol is 4. It was introduced in Python 3.4, and is incompatible
with previous versions.

Specifying a negative protocol version selects the highest protocol
Expand All @@ -7726,7 +7727,7 @@ into *file* as part of the pickle stream. It is an error if
static PyObject *
_pickle_dumps_impl(PyObject *module, PyObject *obj, PyObject *protocol,
int fix_imports, PyObject *buffer_callback)
/*[clinic end generated code: output=fbab0093a5580fdf input=9f334d535ff7194f]*/
/*[clinic end generated code: output=fbab0093a5580fdf input=e543272436c6f987]*/
{
PyObject *result;
PicklerObject *pickler = _Pickler_New();
Expand Down
15 changes: 8 additions & 7 deletions Modules/clinic/_pickle.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.