FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-141510, PEP 814: Add frozendict support to pickle by vstinner · Pull Request #144936 · python/cpython · GitHub

/ cpython Public

gh-141510, PEP 814: Add frozendict support to pickle - #144936

Closed
vstinner wants to merge 4 commits into
python:mainfrom
vstinner:frozendict_pickle
Closed

gh-141510, PEP 814: Add frozendict support to pickle#144936
vstinner wants to merge 4 commits into
python:mainfrom
vstinner:frozendict_pickle

Conversation

vstinner commented Feb 17, 2026
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member Author

I mark the PR as a draft since test_pickle fails on the test that I added:

FAIL: test_recursive_frozendict_and_inst (test.test_pickle.InMemoryPickleTests.test_recursive_frozendict_and_inst) (proto=5)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/pickletester.py", line 2852, in _test_recursive_collection_and_inst
    self.assertIs(list(x)[0].attr, x)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
AssertionError: frozendict({<test.picklecommon.Object object at 0x200009adea0>: None}) is not frozendict({<test.picklecommon.Object object at 0x200009adea0>: None})

Copy link
Copy Markdown
Member Author

I mark the PR as a draft since test_pickle fails on the test that I added

Ah it's ok, I found the issue: the C implementation was not correct. It's not fixed.

vstinner marked this pull request as ready for review February 18, 2026 17:19

Copy link
Copy Markdown
Member Author

cc @serhiy-storchaka @avassalotti

Copy link
Copy Markdown
Member

You do not need to change the pickle module. Just add the __getnewargs__() method returning (dict(self),) or (list(self.items()),).

Adding a new pickle opcode requires a separate PEP.

Copy link
Copy Markdown
Member Author

You do not need to change the pickle module. Just add the __getnewargs__() method returning (dict(self),) or (list(self.items()),).

Oh, I didn't know that it was so simple :-) I wrote #144967 to implement __getnewargs__().

vstinner marked this pull request as draft February 18, 2026 18:20

Copy link
Copy Markdown
Member Author

I close this PR in favor of the more complete #144967 PR.

vstinner closed this Feb 20, 2026
vstinner deleted the frozendict_pickle branch February 20, 2026 00:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL