gh-75572: Forward-port test_xpickle from Python 2 to 3.
https://bugs.python.org/issue31391
Apart from porting test_xpickle, a resource was also added in libregrtest's command line options (as this was originally available in Py2 but removed in Py3, and the test takes considerably long).
I have tested the code against Windows 10 and Ubuntu 20.04. It is also compatible with the py launcher in Windows (PEP 397). In total, it takes around 14 minutes to run the entire test on Ubuntu 20.04, which isn't all that surprising considering the Py2 tests took a few minutes to run, and pickletester has added many more test functions since then.
Compatible versions to bounce pickles from are Python 3.6 - 3.9. Supporting Python 3.5 wasn't feasible since the pickletester library has to be imported, and it has generous use of f-strings.
This is my first time contributing to CPython, and I'd really like feedback on how I can improve this PR, thanks!
https://bugs.python.org/issue31391
- Issue: gh-75572
@iritkatriel , thanks for the really thorough review, I have implemented most of the suggestions
Thank you for your PR, @Fidget-Spinner. This is a great work, especially for the first contribution (you contributed after this a lot, and it was valuable contribution). Unfortunately, the PR became slightly outdated, and new conflicts were introduced.
I resolved conflicts and fixed other incompatibilities:
- Python tests no longer use test_main(). The tests should be generated in
load_tests(). -
test.supportno longer compatible with older Python versions. I fixed some errors, but currently it only work in 3.8 and newer. It is possible to make it working in 3.7 at the cost of getting rid of positional-only parameters, but is more difficult to go further. - Some new tests which test pickling all builtins need corrections.
We perhaps can make more tests supporting by moving some code to separate files, but the current version is already great.
By moving the testing classes to a separate module I managed to fix support for 3.5+. Only this module is shared between versions, so we have no restrictions to uise new syntax in tests.
Thanks @Fidget-Spinner for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. 🐍🍒⛏🤖
Sorry, @Fidget-Spinner and @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 8735daf3e82d50defd791e9be7b9ae6843bc4ed1 3.13
GH-143485 is a backport of this pull request to the 3.14 branch.
GH-143509 is a backport of this pull request to the 3.13 branch.