Skip to content

Make sure copy and deepcopy are returning same class #460

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 15, 2017

Conversation

mitar
Copy link
Contributor

@mitar mitar commented Aug 14, 2017

This should hold on Python 3.3 and newer (it does not hold on 3.2 and 2.7).

From documentation:

It does “copy” functions and classes (shallow and deeply), by returning the original object unchanged; this is compatible with the way these are treated by the pickle module.

This should hold on Python 3.3 and newer (it does not hold on 3.2 and 2.7).
@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@ilevkivskyi
Copy link
Member

@ethanhs could you please take a look at the test failure? May this be fixed by something like python/mypy#3777?

@emmatyping
Copy link
Member

@ilevkivskyi yes, you are right. Opened #462.

@@ -1069,6 +1069,9 @@ class Node(Generic[T]): ...
for t in things + [Any]:
self.assertEqual(t, copy(t))
self.assertEqual(t, deepcopy(t))
if sys.version_info >= (3, 3):
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add a comment here explaining why we need this?

@mitar
Copy link
Contributor Author

mitar commented Aug 15, 2017

Done.

@@ -1070,6 +1070,10 @@ class Node(Generic[T]): ...
self.assertEqual(t, copy(t))
self.assertEqual(t, deepcopy(t))
if sys.version_info >= (3, 3):
# From copy module documentation:
# It does “copy” functions and classes (shallow and deeply), by returning
Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Just one more thing: we generally prefer not to use non-ASCII characters in stdlib (and this repo is upstream for stdlib). Here you copied quotes from the HTML docs that are non-ASCII, could you please switch to ASCII quotes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I will fix this now.

@mitar
Copy link
Contributor Author

mitar commented Aug 15, 2017

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants