diff --git a/mercurial/smartset.py b/mercurial/smartset.py --- a/mercurial/smartset.py +++ b/mercurial/smartset.py @@ -871,7 +871,10 @@ class generatorset(abstractsmartset): if i < _len(genlist): yield genlist[i] else: - yield _next(nextgen) + try: + yield _next(nextgen) + except StopIteration: + return i += 1 return gen()