GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-93627: Align copy module behaviour with pickle module by eendebakpt · Pull Request #109498 · python/cpython

Conversation

@eendebakpt

@eendebakpt eendebakpt commented Sep 16, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

  • Issue: Inconsistency in handling None handlers in the Python and C implementations of pickle #93627

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@eendebakpt
Align copy module behaviour with pickle module
1535893
@bedevere-app bedevere-app Bot added the awaiting review label Sep 16, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Sep 16, 2023
Inconsistency in handling None handlers in the Python and C implementations of pickle #93627
Open
blurb-it Bot and others added 3 commits September 16, 2023 19:19
@blurb-it
📜🤖 Added by blurb_it.
30d6b97
@eendebakpt
align behaviour of __replace__
c97105f
@eendebakpt
Merge branch 'pickle_copy' of github.com:eendebakpt/cpython into pick…
7da7086
…le_copy
@eendebakpt eendebakpt mentioned this pull request Sep 16, 2023
gh-93627: Align Python implementation of pickle with C implementation of pickle #103035
Merged
@eendebakpt 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
eendebakpt added 2 commits September 25, 2023 22:34
@eendebakpt
Merge branch 'main' into pickle_copy
e54350f
@eendebakpt
Merge branch 'main' into pickle_copy
368f99e
@eendebakpt eendebakpt mentioned this pull request Oct 4, 2023
gh-72793: C implementation of parts of copy.deepcopy #91610
Closed
eendebakpt added 4 commits October 4, 2023 20:32
@eendebakpt
Merge branch 'main' into pickle_copy
6d31123
@eendebakpt
Merge branch 'main' into pickle_copy
35046a4
@eendebakpt
Merge branch 'main' into pickle_copy
817077f
@eendebakpt
Merge branch 'main' into pickle_copy
2396484
@eendebakpt

eendebakpt commented Dec 5, 2023

Copy link
Copy Markdown
Contributor Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eendebakpt added 3 commits December 14, 2023 23:19
@eendebakpt
Merge branch 'main' into pickle_copy
0b26813
@eendebakpt
Merge branch 'main' into pickle_copy
3aeb310
@eendebakpt
Merge branch 'main' into pickle_copy
a924c78
@erlend-aasland
erlend-aasland requested a review from serhiy-storchaka April 4, 2024 07:31
@skirpichev
Merge branch 'main' into pickle_copy
7b6b57a
@skirpichev

skirpichev commented Oct 13, 2024

Copy link
Copy Markdown
Member

I took liberty to fix a merge conflict.

eendebakpt reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eendebakpt added 4 commits December 10, 2024 22:21
@eendebakpt
Merge branch 'main' into pickle_copy
f481db6
@eendebakpt
lint
d451ba4
@eendebakpt
Merge branch 'main' into pickle_copy
5148248
@eendebakpt
Merge branch 'main' into pickle_copy
ff7f162
@serhiy-storchaka serhiy-storchaka mentioned this pull request Sep 3, 2025
gh-132657: Make deepcopy and copy scale with free-threading #138429
Merged
@eendebakpt
Merge branch 'main' into pickle_copy
37916b0
@github-actions

github-actions Bot commented Apr 13, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 13, 2026
@eendebakpt
Merge branch 'main' into pickle_copy
1308ed3
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 12, 2026
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka Awaiting requested review from serhiy-storchaka

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

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.

2 participants

@eendebakpt @skirpichev
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.