2010/12/13 Stefan Behnel <stefan...@behnel.de>:
> Vitja Makarov, 13.12.2010 07:49:
>> 2010/12/13 Stefan Behnel:
>>> Vitja Makarov, 12.12.2010 20:23:
>>>> I've cleaned generators stuff a little:
>>>>
>>>>    * Turn YieldNodeCollector into TreeVisitor
>>>
>>> I think that's ok. It's a bit redundant with the tree traversal that
>>> happens anyway, but it also keeps the code more compact and makes it more
>>> understandable.
>>>
>>> BTW, please start using error test cases. That would easily have caught the
>>> obvious reporting bug in visit_ReturnStatNode.
>>
>> I was thinking about that. I also found that 'return' statment is
>> allowed inside generators.
>> That should raise StopIteration and close generator.
>> Don't know how to go here replace ReturnStatNode with another one
>
> You can replace it by the equivalent of "raise StopIteration" during the
> MarkClosureVisitor transform, e.g. inside of the YieldNodeCollector (which
> would then have to be a transform again). Either emit a compiler error if
> the return statement has an argument (IIRC that's the forbidden case) or
> replace the node if it has none.
>
>

That shold be much better to jump to the place where StopIteration is raised.
Couse StopIteration should not be catched here and finallize should be called.

>>>>    * Move ClosureTempAllocator to Code.py
>>>
>>> I still think that the reference should live in FunctionState so that it
>>> goes out of scope automatically. It shouldn't live longer than the function.
>>>
>>
>> Ok, I'll put reference to code.funcstate, or maybe add method to
>> funcstate set_closure_class()
>> That will create tempallocator?
>
> Hmm, not sure. What about adding an "init_generator_temps(scope)" method to
> it that creates the CTA and attaches it to the current funcstate?
>


Ok

> Stefan
> _______________________________________________
> Cython-dev mailing list
> Cython-dev@codespeak.net
> http://codespeak.net/mailman/listinfo/cython-dev
>



-- 
vitja.
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to