Skip to content

bpo-27639: Correct return type for UserList slicing operation #13169

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
May 7, 2019

Conversation

mblahay
Copy link
Contributor

@mblahay mblahay commented May 7, 2019

Added logic to __getitem__ magic method for UserList to ensure that the return
type matches that of self.

https://bugs.python.org/issue27639

Added logic to __getitem__ magic method for UserList to ensure that the return
type matches that of self.
@mblahay mblahay requested a review from rhettinger as a code owner May 7, 2019 19:11
@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.

You can check yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

@matrixise matrixise changed the title BPO-27639: Correct return type for UserList slicing operation bpo-27639: Correct return type for UserList slicing operation May 7, 2019
@markshannon markshannon self-assigned this May 7, 2019
def test_slice_type(self):
l = [0, 1, 2, 3, 4]
u = UserList(l)
self.assertIsInstance(u[:], u.__class__)
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test that u[:] == u, thanks.

@markshannon markshannon added needs backport to 3.7 type-bug An unexpected behavior, bug, or error labels May 7, 2019
@markshannon markshannon merged commit b1c3167 into python:master May 7, 2019
@bedevere-bot
Copy link

@markshannon: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington
Copy link
Contributor

Thanks @mblahay for the PR, and @markshannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 7, 2019
…GH-13169)

* BPO-27639: Correct return type for UserList slicing operation

Added logic to __getitem__ magic method for UserList to ensure that the return
type matches that of self.
(cherry picked from commit b1c3167)

Co-authored-by: Michael Blahay <[email protected]>
@bedevere-bot
Copy link

GH-13181 is a backport of this pull request to the 3.7 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants