Make sure copy and deepcopy are returning same class#460
Make sure copy and deepcopy are returning same class#460ilevkivskyi merged 3 commits intopython:masterfrom
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. |
| 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.
Could you please add a comment here explaining why we need this?
|
Done. |
src/test_typing.py
Outdated
| 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.
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.
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: