[pypy-dev] help fully fixing generators...?
aleaxit at yahoo.com
Mon Dec 22 17:14:17 CET 2003
On Monday 22 December 2003 03:49 pm, Armin Rigo wrote:
> Hello Alex,
> 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.
Aye aye, cap'n -- done, and removed the hook you disliked (now unneeded).
test_all.py -S passes, including new unit tests regarding generators raising
or propagating StopIteration exceptions.
More information about the Pypy-dev