[pypy-dev] help fully fixing generators...?
arigo at tunes.org
Mon Dec 22 15:49:12 CET 2003
On Mon, Dec 22, 2003 at 01:32:55AM +0100, Alex Martelli wrote:
> easily fixed it for a simple "raise StopIteration" in the generator itself,
> and committed that change (as well as the unit-test showing the bug
> existed), but I'm not sure where to edit to fix it when the StopIteration
> is being PROPAGATED from a call to something.next() in the generator, which
> is what enumerate needs.
The whole business of StopIteration vs. the interp-level "NoValue" exception
is unclean, but your hack to change the semantics of the "raise" statement is
worse :-) Instead, you should catch the OperationError in pypy_next(), in the
call to Frame.run(), and turn it into a NoValue.
More information about the Pypy-dev