Skip to content

Make sure copy and deepcopy are returning same class#460

Merged
ilevkivskyi merged 3 commits into
python:masterfrom
mitar:patch-1
Aug 15, 2017
Merged

Make sure copy and deepcopy are returning same class#460
ilevkivskyi merged 3 commits into
python:masterfrom
mitar:patch-1

Conversation

@mitar

@mitar mitar commented Aug 14, 2017

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Member

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

Comment thread src/test_typing.py
for t in things + [Any]:
self.assertEqual(t, copy(t))
self.assertEqual(t, deepcopy(t))
if sys.version_info >= (3, 3):

Copy link
Copy Markdown
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

mitar commented Aug 15, 2017

Copy link
Copy Markdown
Contributor Author

Done.

Comment thread 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

Copy link
Copy Markdown
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
Copy Markdown
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

mitar commented Aug 15, 2017

Copy link
Copy Markdown
Contributor Author

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