Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-93627: Align copy module behaviour with pickle module#109498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
eendebakpt wants to merge18 commits intopython:main
base:main
Choose a base branch
Loading
fromeendebakpt:pickle_copy

Conversation

eendebakpt
Copy link
Contributor

@eendebakpteendebakpt commentedSep 16, 2023
edited
Loading

In this PR we align the behavior of thecopy module with thepickle module. See#93627 and#103035 for more discussion. For example:

import copyclass C(object):    __copy__ = Nonex= 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 withpickle, 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

@eendebakpteendebakpt changed the titleDraft: gh-93627: Align copy module behaviour with pickle modulegh-93627: Align copy module behaviour with pickle moduleSep 16, 2023
@eendebakpt
Copy link
ContributorAuthor

@serhiy-storchaka As the creator of the corresponding issue, would you be able to review this PR?

@skirpichev
Copy link
Member

I took liberty to fix a merge conflict.

eendebakpt reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@serhiy-storchakaserhiy-storchakaAwaiting requested review from serhiy-storchaka

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@eendebakpt@skirpichev

[8]ページ先頭

©2009-2025 Movatter.jp