[utils] Fix `PagedList`

Bug in d8cf8d97a8
pull/1727/head
pukkandan 3 years ago
parent c5e3f84972
commit c07a39ae8e
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698

@ -1328,7 +1328,7 @@ class YoutubeDL(object):
self.to_stderr('\r')
self.report_warning(f'{e}; Re-extracting data')
return wrapper(self, *args, **kwargs)
except (DownloadCancelled, LazyList.IndexError):
except (DownloadCancelled, LazyList.IndexError, PagedList.IndexError):
raise
except Exception as e:
if self.params.get('ignoreerrors'):

@ -4168,6 +4168,10 @@ class LazyList(collections.abc.Sequence):
class PagedList:
class IndexError(IndexError):
pass
def __len__(self):
# This is only useful for tests
return len(self.getslice())
@ -4198,7 +4202,7 @@ class PagedList:
raise TypeError('indices must be non-negative integers')
entries = self.getslice(idx, idx + 1)
if not entries:
raise IndexError()
raise self.IndexError()
return entries[0]

Loading…
Cancel
Save