Michael Blahay <mbla...@gmail.com> added the comment:

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])

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27639>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to