bpo-27639: Correct return type for UserList slicing operation#13169
bpo-27639: Correct return type for UserList slicing operation#13169markshannon merged 3 commits intopython:masterfrom
Conversation
Added logic to __getitem__ magic method for UserList to ensure that the return type matches that of self.
|
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! |
| def test_slice_type(self): | ||
| l = [0, 1, 2, 3, 4] | ||
| u = UserList(l) | ||
| self.assertIsInstance(u[:], u.__class__) |
There was a problem hiding this comment.
Can you add a test that u[:] == u, thanks.
|
@markshannon: Please replace |
|
Thanks @mblahay for the PR, and @markshannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
|
GH-13181 is a backport of this pull request to the 3.7 branch. |
Added logic to
__getitem__magic method for UserList to ensure that the returntype matches that of self.
https://bugs.python.org/issue27639