From c920dafc908188b55cf7c7a6afcd9976c3b4099c Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Sun, 22 Dec 2024 16:13:06 -0500 Subject: [PATCH] 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]: https://github.com/python/cpython/issues/128211 --- qui/updater/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qui/updater/utils.py b/qui/updater/utils.py index 2a646521..fce7cced 100644 --- a/qui/updater/utils.py +++ b/qui/updater/utils.py @@ -264,6 +264,9 @@ def __init__(self, list_store_wrapped): self.list_store_wrapped = list_store_wrapped self._id = -1 + def __iter__(self) -> 'UpdateListIter': + return self + def __next__(self) -> RowWrapper: self._id += 1 if 0 <= self._id < len(self.list_store_wrapped):