gh-144782: Make sure that ArgumentParser instances are pickleable#144783
gh-144782: Make sure that ArgumentParser instances are pickleable#144783mauvilsa wants to merge 5 commits intopython:mainfrom
Conversation
Misc/NEWS.d/next/Library/2026-02-13-14-20-10.gh-issue-144782.0Y8TKj.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
|
Recent changes in 3.14.3 is making jsonargparse tests fail, see actions/runs/21987177775. Would be good to backport this to 3.14, otherwise pytorch-lightning multiprocessing will be broken on 3.14. From what I understood in the docs this pull request should have a |
Misc/NEWS.d/next/Library/2026-02-13-14-20-10.gh-issue-144782.0Y8TKj.rst
Outdated
Show resolved
Hide resolved
…Y8TKj.rst Co-authored-by: AN Long <aisk@users.noreply.github.com>
| self.assertEqual(ns.bar, 'quux') | ||
| ns2 = parser2.parse_args([]) | ||
| self.assertEqual(ns2.foo, 42) | ||
| self.assertEqual(ns2.bar, 'baz') |
There was a problem hiding this comment.
Do we want to test all pickle protocols, as in test_uuid.BaseTestUUID.test_pickle_roundtrip? cc @savannahostrowski @serhiy-storchaka
There was a problem hiding this comment.
Sure, I can do that. Should I wait for a response from @savannahostrowski @serhiy-storchaka?
There was a problem hiding this comment.
I think you don't need to wait, @mauvilsa. I've checked this more carefully now and there are lots and lots of precedents that test all protocols:
test_array.BaseTest.test_pickle(+related)test_bool.BoolTest.test_pickletest_collections.TestChainMap.test_basics- all
test_configparser.ExceptionPicklingTestCasetest methods test_decimal.ContextAPItests.test_pickletest_functools.TestPartial.test_recursive_pickle- much more!
Every roundtrip pickling test I'm looking at covers multiple protocols. I'd say go ahead, it might actually be a requirement we want to uphold in every pickling test :-)
Bug fixes are backported, yes (to 3.13 as well at the time of writing). The labels can be applied at any point, even after merge. I'm leaving the decision whether we backport this or not to @savannahostrowski -- I'm not sure if this is a bug fix and not a feature, but it seems very reasonable to backport it, so you have a +1 from me in any case! |
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Changes so that
argparse.ArgumentParserinstances are pickleable and a unit test so that this behavior is preserved.Fixes issue #144782