bpo-37210: Fix pure Python pickle: proto 5 requires _pickle.PickleBuffer#14016
Conversation
|
@pitrou: Would you mind to review my change? Does it sound reasonable to you? |
|
This sounds both fine but almost pointless to me. Is it for |
It repairs pyperformance, right: to measure performances of the pure Python implementation of pickle. But other Python implementations (PyPy, MicroPython, RustPython, etc.) should also benefit of this change to reuse CPython pickle.py if they miss the _pickle module. |
|
Ok. I'm not sure you need to downgrade the protocol to 4. You can just disable the code paths which depend on PickleBuffer. |
Fix pure Python implementation of pickle: it failed with ModuleNotFoundError on importing _pickle.PickleBuffer. If _pickle.PickleBuffer is missing, disable PickleBuffer support. Fix test_pickle when _pickle is missing: declare PyPicklerHookTests outside "if has_c_implementation:" block.
Oh, I wasn't sure. I tested test_pickle with I rebased my PR, I reverted my HIGHEST_PROTOCOL change and I made another tiny fix in test_pickle when _pickle is missing. |
|
@pitrou: Does it look better now? |
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
…GH-14016) Allow pure Python implementation of pickle to work even when the C _pickle module is unavailable. Fix test_pickle when _pickle is missing: declare PyPicklerHookTests outside "if has_c_implementation:" block. (cherry picked from commit 63ab4ba) Co-authored-by: Victor Stinner <vstinner@redhat.com>
|
GH-14055 is a backport of this pull request to the 3.8 branch. |
|
@pitrou: Thanks for the review, I updated the commit message using your NEWS entry ;-) |
Allow pure Python implementation of pickle to work even when the C _pickle module is unavailable. Fix test_pickle when _pickle is missing: declare PyPicklerHookTests outside "if has_c_implementation:" block. (cherry picked from commit 63ab4ba) Co-authored-by: Victor Stinner <vstinner@redhat.com>
…GH-14016) Allow pure Python implementation of pickle to work even when the C _pickle module is unavailable. Fix test_pickle when _pickle is missing: declare PyPicklerHookTests outside "if has_c_implementation:" block.
…GH-14016) Allow pure Python implementation of pickle to work even when the C _pickle module is unavailable. Fix test_pickle when _pickle is missing: declare PyPicklerHookTests outside "if has_c_implementation:" block.
Fix pure Python implementation of pickle: it failed with
ModuleNotFoundError on importing _pickle.PickleBuffer. If
_pickle.PickleBuffer is missing, change HIGHEST_PROTOCOL from 5 to 4
and disable PickleBuffer support.
https://bugs.python.org/issue37210