Vitja Makarov, 08.12.2010 22:45:
> Please review this patch. It's not yet finished, and mostly doesn't work.
> But you can take a look at patch and generated code.

*Way* cool, thanks! I'll take a close look ASAP. Please feel free to send 
in a new patch when you have it. If you use hg, you can use "hg bundle" to 
collect commit series. Don't know about git.

BTW, why not set up a github branch for this?


>   - Temps are saved/restored/allocated inside YieldExprNode using
> helper ClosureTempAllocator
>   - PyxGenerator methods are defined via declare_var

Should we call that "CyGenerator" ? :)


>   - Send,  __next__(), __iter__() are implemented while close(), throw() 
> aren't
>   - YieldExprNode doesn't handle exceptions

Ok, sure, that's why close() and throw() don't work yet. I think that's 
fine for now. The first three are the most interesting ones. However, 
adding exception support shouldn't be hard at all, AFAICT, but they may 
benefit from a cdef function for the generator body in order to properly 
pass in the exception propagation trigger.


>   - I don't know how to make refnanny work, should refnanny context be
> stored in closure?

Good call. That's a tricky question.

What about generating a GIVEREF for every Python temp you store in the 
closure, a GOTREF for everything you take back out, and finish/restart the 
refnanny context around the yield?


>   - Comprehensions are now handled by OldYieldExprNode

... another one of those bad names. ;)

Any reason you couldn't reuse it for both?

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

Reply via email to