This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mblahay
Recipients mblahay, r.david.murray, rhettinger, serhiy.storchaka, staticshock, vaultah
Date 2019-05-06.20:52:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557175941.28.0.489769365664.issue27639@roundup.psfhosted.org>
In-reply-to
Content
The root cause of this issue seems to be the failure to implement type usage in __getitem__ when the deprecated __getslice__ was removed. This is why slicing worked correctly in 2.7, but not the 3.x versions.

In 3.8, the __getitem__ method is used to create the slice, but here we can see that all it does is pass the task to data, which is of type list and then fails to convert the result to the correct type.

  def __getitem__(self, i): return self.data[i]

Using other methods as examples, the fix should look like this:

  def __getitem__(self, i): return self.__class__(self.data[i])
History
Date User Action Args
2019-05-06 20:52:21mblahaysetrecipients: + mblahay, rhettinger, r.david.murray, serhiy.storchaka, vaultah, staticshock
2019-05-06 20:52:21mblahaysetmessageid: <1557175941.28.0.489769365664.issue27639@roundup.psfhosted.org>
2019-05-06 20:52:21mblahaylinkissue27639 messages
2019-05-06 20:52:21mblahaycreate