Closed lonetech closed 4 years ago
Hi,
The __iter__
method doesn't raise StopIteration
since version 0.4.0 (commit 3e2c52537d56db80b5eb6f2a05c4809e2692f3ac), are you using the latest release ?
I remember checking the source repo, but must have gotten lost in another branch (maybe where it was cloned from). Sorry for the duplicate.
My starting point was stumbling upon the bug in the Ubuntu package version 0.3.1-1. Debian appears to still have that same version. So no, I wasn't using the latest version, a second mistake.
By the way, you don't need the return statement either (a function that reaches the end returns implicitly). Thanks for the PEP 479 link; I learned how this extra StopIteration could make it in to begin with.
The
__iter__
method inMultiCallIterator
is a generator, using theyield
statement to produce results. As such it should simply return in the end, not raise any exception. Just remove theraise StopIteration
line to correct this bug.In addition, the entire method is unnecessary, as
iter()
can derive it from__len__
and__getitem__
. Outright removing__iter__
therefore also fixes the bug.