gh-153612: Add copyreg.copy() and copyreg.deepcopy()#153613
Open
serhiy-storchaka wants to merge 2 commits into
Open
gh-153612: Add copyreg.copy() and copyreg.deepcopy()#153613serhiy-storchaka wants to merge 2 commits into
serhiy-storchaka wants to merge 2 commits into
Conversation
Register shallow and deep copy functions for instances of types that cannot be modified. copy.copy() and copy.deepcopy() use them in preference to the __copy__ and __deepcopy__ special methods and the pickle interfaces, without affecting pickling. The public dispatch tables also hold the handlers for the built-in container types; the private copy._deepcopy_dispatch is removed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Documentation build overview
7 files changed ·
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add registration of shallow and deep copy functions for instances of types that cannot be modified, following the
copyreg.pickle()precedent.copy.copy()andcopy.deepcopy()use the registered functions in preference to the__copy__/__deepcopy__special methods and the pickle interfaces. Registration is by exact type and does not affect pickling.The registries are the public tables
copyreg.copy_dispatch_tableandcopyreg.deepcopy_dispatch_table, which also hold the handlers for the built-in container types. The private_deepcopy_dispatchis removed, following the removal of_copy_dispatchin gh-128118.Closes gh-153612.
🤖 Generated with Claude Code