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

gh-141510: Implement copy and deepcopy for frozendict by eendebakpt · Pull Request #144905 · python/cpython · GitHub

/ cpython Public

gh-141510: Implement copy and deepcopy for frozendict - #144905

Merged
vstinner merged 9 commits into
python:mainfrom
eendebakpt:copy_module_frozendict
Feb 18, 2026
Merged

gh-141510: Implement copy and deepcopy for frozendict#144905
vstinner merged 9 commits into
python:mainfrom
eendebakpt:copy_module_frozendict

Conversation

eendebakpt commented Feb 17, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

eendebakpt changed the title gh-41510: Implement copy and deepcopy for frozendict gh-141510: Implement copy and deepcopy for frozendict Feb 17, 2026
eendebakpt marked this pull request as draft February 17, 2026 11:37

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why is it a draft PR?

Changes cherry-picked from #141508 by @vstinner

I'm surprised that you created a PR from my WIP work. I'm currently splitting this big PR into smaller pieces, as I wrote in the PR.

Comment thread Lib/test/test_copy.py Outdated

eendebakpt commented Feb 17, 2026
edited
Loading

Copy link
Copy Markdown
Contributor Author

Draft because there are failing tests are due to making _deepcopy_dispatch immutable. The failing test is a bit strange, see

# This is an ugly hack:

I will look into this.

eendebakpt commented Feb 17, 2026
edited
Loading

Copy link
Copy Markdown
Contributor Author

I'm surprised that you created a PR from my WIP work. I'm currently splitting this big PR into smaller pieces, as I wrote in the PR.

Sorry, my mistake. Feel free to close the PR if it is interfering.

Comment thread Lib/copy.py Outdated
return type(x)(x.__func__, deepcopy(x.__self__, memo))
d[types.MethodType] = _deepcopy_method

_deepcopy_dispatch = frozendict(d)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I would prefer to not convert it to a frozendict in this PR, since it's not directly related to supporting frozendict in copy: remove this line and revert test_descr changes.

eendebakpt Feb 17, 2026
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'll remove it here. Do you want me to open a separate PR for this part?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I wrote #144909 to use frozendict in multiple stdlib modules. I will to see how this PR goes before proposing changing copy._deepcopy_dispatch to frozendict.

Comment thread Lib/test/test_descr.py Outdated
eendebakpt marked this pull request as ready for review February 17, 2026 22:55
vstinner merged commit dd64e42 into python:main Feb 18, 2026
49 checks passed

Copy link
Copy Markdown
Member

Merged, thanks.

Copy link
Copy Markdown
Member

Ah, the implementation doesn't work for recursive frozendict. I created #145027 to fix copy.deepcopy() for recursive frozendict.

brijkapadia pushed a commit to brijkapadia/cpython that referenced this pull request Feb 28, 2026
…44905)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
…44905)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL