On Mon, 18 Nov 2024 22:46:38 +0100 Fiona Klute <fiona.kl...@gmx.de> wrote: > On Mon, 18 Nov 2024 12:08:36 +0500 Andrey Rakhmatullin <w...@debian.org> > wrote: > > I checked the upstream and found that the packaged version already claims > > to support 3.13, and they indeed run 3.13 tests on CI. So this is weird. > Looking at the code of the GenericIterator class [1], the error is > correct: It's missing the __iter__() method that's required for > iterators. To quote the Python docs [2]: > > > Iterators are required to have an __iter__() method that returns the > > iterator object itself so every iterator is also iterable and may be > > used in most places where other iterables are accepted. > > [...] > > CPython implementation detail: CPython does not consistently apply > > the requirement that an iterator define __iter__(). And also please > > note that the free-threading CPython does not guarantee the thread- > > safety of iterator operations. > I've reproduced the bug locally, and indeed patching in an __iter__ > method solves the problem (patch attached). So this looks like an > upstream bug. I'd still be very curious exactly what about the "not > consistently" applied requirement doesn't trigger in the upstream tests > but does on Debian. :-) > > [1] > https://github.com/libgit2/pygit2/blob/eba710e45bb40e18641c6531394bb46631e7f295/pygit2/utils.py#L156C7-L156C22 > [2] https://docs.python.org/3.13/glossary.html#term-iterator
It looks like it worked with 3.13 final (3.13.0-1) but it broke after the Debian package updated to the 3.13 branch from 2024-11-12 (3.13.0-2). My guess is this commit [1] resulted in the generator expression now requiring the __iter__() method to be defined, causing the test failure we see here. - Fay [1] https://github.com/python/cpython/commit/bcc7227ef7fd21aa48c8f1c57922e8beced5737c