bpo-23403: Bump pickle.DEFAULT_PROTOCOL to 4 by ambv · Pull Request #6355 · python/cpython

@ambv

This makes performance better and produces shorter pickles. This change is backwards compatible up to the oldest currently supported version of Python (3.4).

https://bugs.python.org/issue23403

serhiy-storchaka

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update docstrings, the module documentation, and What's New.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a reStructuredText, we can add links: :mod:`pickle`, :pep:`3154`.

@ambv

Lib/test/pickletester.py:AbstractPicklerUnpicklerObjectTests.test_clear_pickler_memo is failing for CPicklerUnpicklerObjectTests only. This seems like a bug to me since it passes on the same protocol in the pure-Python implementation (PyPicklerUnpicklerObjectTests).

@pitrou Could you take a look?

serhiy-storchaka

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is other mention of the default protocol 3 in the module documentation.

Regenerate Argument Clinic files and fix tests.

@ambv

@serhiy-storchaka, updated the remaining comment on default protocol 3, regenerated Argument Clinic. For the failing test, see my comment above, I'm not sure what the fix should be here.

@serhiy-storchaka

I think there is a bug in C implementation. Opened bpo-33209.

serhiy-storchaka

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe add a versionchanged directive somewhere in pickle.rst?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nit: it is preferable to use an en-dash for the version range.

This makes performance better and produces shorter pickles. This change is backwards compatible up to the oldest currently supported version of Python (3.4).

@ambv

Responded to remaining nits and rebased to include GH-6363. All tests pass now.

serhiy-storchaka

@bedevere-bot

@ambv: Please replace # with GH- in the commit message next time. Thanks!

@ambv ambv deleted the pickle4 branch

July 12, 2021 11:24