-
Notifications
You must be signed in to change notification settings - Fork 258
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
Conversation
This should hold on Python 3.3 and newer (it does not hold on 3.2 and 2.7).
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! |
@ethanhs could you please take a look at the test failure? May this be fixed by something like python/mypy#3777? |
@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): |
There was a problem hiding this comment.
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?
Done. |
src/test_typing.py
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Done. |
This should hold on Python 3.3 and newer (it does not hold on 3.2 and 2.7).
From documentation: