Skip to content

Commit 41ba839

Browse files
committed
updater: make UpdateListIter a proper iterator
Python iterators are required to implement an __iter__() that returns self [1]. CPython doesn't check this consistently, but the requirement is still there, so the existing code is buggy. Python 3.13 started checking this in list comprehensions, resulting in exceptions being thrown. Fix the bug by having __iter__() return self, as required by the iterator protocol. This worked on Python 3.13 and below, but broke in 3.13.1 [2]. [1]: https://docs.python.org/3/glossary.html#term-iterator [2]: python/cpython#128211
1 parent a3e4d17 commit 41ba839

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

qui/updater/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ def __init__(self, list_store_wrapped):
264264
self.list_store_wrapped = list_store_wrapped
265265
self._id = -1
266266

267+
def __iter__(self) -> 'UpdateListIter':
268+
return self
269+
267270
def __next__(self) -> RowWrapper:
268271
self._id += 1
269272
if 0 <= self._id < len(self.list_store_wrapped):

0 commit comments

Comments
 (0)