GeezerVison is showing github.com — gh-93627: Align copy module behaviour with pickle module by eendebakpt · Pull Request #109498 · python/cpython
Conversation
eendebakpt
commented
Sep 16, 2023
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
In this PR we align the behavior of the copy module with the pickle module. See #93627 and #103035 for more discussion. For example:
import copy
class C(object):
__copy__ = None
x= C()
copy.copy(x) # returns a copy on main, with this PR raises a TypeError
The more consistent behaviour in this PR has to be weighted against the alternative option: keep the current behaviour (which is backwards compatible).
Some notes:
-
Changing the behaviour does not break any existing unit tests. For either this PR, or the keeping the current behaviour, we can add tests to ensure the behaviour in the future.
-
One variation is to change the behavior of __reduce_ex__ and __reduce__ attributes to align with pickle, but do not modify the behaviour of __copy__ and __deepcopy__ (these methods are specific for the copy module and not present in the pickle module
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
eendebakpt
changed the title
Draft: gh-93627: Align copy module behaviour with pickle module
gh-93627: Align copy module behaviour with pickle module
Sep 16, 2023
|
@serhiy-storchaka As the creator of the corresponding issue, would you be able to review this PR?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I took liberty to fix a merge conflict.
|
eendebakpt reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 90 days with no activity.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|