Skip to content

Commit c920daf

Browse files
committed
updater: workaround CPython bug 128211
Python 3.13 list comprehensions are buggy [1]: [i for i in x] calls iter(iter(x)) instead of just iter(x). Work around the bug by having UpdateListIter have a __iter__(self) that just returns self. This is the same thing that the standard library does: x = iter([]) print(x is iter(x)) prints True. [1]: python/cpython#128211
1 parent a3e4d17 commit c920daf

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)