Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-75572: Forward-port test_xpickle from Python 2 to 3.#22452

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@Fidget-Spinner
Copy link
Member

@Fidget-SpinnerFidget-Spinner commentedSep 29, 2020
edited by bedevere-bot
Loading

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

@Fidget-Spinner
Copy link
MemberAuthor

@iritkatriel , thanks for the really thorough review, I have implemented most of the suggestions

@AlexWaygoodAlexWaygood changed the titlebpo-31391: Forward-port test_xpickle from Python 2 to 3.gh-75572: Forward-port test_xpickle from Python 2 to 3.Apr 28, 2023
@python-cla-bot
Copy link

python-cla-botbot commentedApr 18, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@serhiy-storchaka
Copy link
Member

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 inload_tests().
  • test.support no 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.

@serhiy-storchaka
Copy link
Member

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.

@serhiy-storchakaserhiy-storchaka added testsTests in the Lib/test dir needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsJan 5, 2026
@serhiy-storchakaserhiy-storchaka merged commit8735daf intopython:mainJan 6, 2026
55 checks passed
@miss-islington-app
Copy link

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.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJan 6, 2026
…H-22452)Move data classes used in tests to separate file test_picklecommon.py,so it can be imported in old Python versions.(cherry picked from commit8735daf)Co-authored-by: Ken Jin <kenjin@python.org>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@miss-islington-app
Copy link

Sorry,@Fidget-Spinner and@serhiy-storchaka, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker 8735daf3e82d50defd791e9be7b9ae6843bc4ed1 3.13

@bedevere-app
Copy link

GH-143485 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelJan 6, 2026
serhiy-storchaka added a commit that referenced this pull requestJan 6, 2026
…) (GH-143485)Move data classes used in tests to separate file test_picklecommon.py,so it can be imported in old Python versions.(cherry picked from commit8735daf)Co-authored-by: Ken Jin <kenjin@python.org>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull requestJan 7, 2026
…ythonGH-22452)Move data classes used in tests to separate file test_picklecommon.py,so it can be imported in old Python versions.(cherry picked from commit8735daf)Co-authored-by: Ken Jin <kenjin@python.org>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull requestJan 7, 2026
…ythonGH-22452)Move data classes used in tests to separate file test_picklecommon.py,so it can be imported in old Python versions.(cherry picked from commit8735daf)(cherry picked from commitff0a8b7)Co-authored-by: Ken Jin <kenjin@python.org>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

GH-143509 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelJan 7, 2026
serhiy-storchaka added a commit that referenced this pull requestJan 7, 2026
…) (GH-143509)Move data classes used in tests to separate file test_picklecommon.py,so it can be imported in old Python versions.(cherry picked from commit8735daf)(cherry picked from commitff0a8b7)Co-authored-by: Ken Jin <kenjin@python.org>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@iritkatrieliritkatrieliritkatriel left review comments

Labels

testsTests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@Fidget-Spinner@serhiy-storchaka@iritkatriel@the-knights-who-say-ni@ezio-melotti@bedevere-bot@hauntsaninja

[8]ページ先頭

©2009-2026 Movatter.jp