[Python-ideas] Revised**7 PEP on Yield-From

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Mar 20 01:23:48 CET 2009


Jacob Holm wrote:

>   1. There is a small refcounting bug in your gen_iternext function. On
>      success, it returns without decref'ing "yf".

Thanks, I'll fix that.

>   2. In the comment for "gen_undelegate" you mention "certain recursive
>      situations" where a generator may lose its frame before we get a
>      chance to clear f_yieldfrom. Can you elaborate?

I can't remember the details, but I definitely ran into one
during development, which is why I added that function. Have
you tried running all of my tests?

>   3. It looks like you are not calling "close" properly from "next",
>      "send" and "throw".

I'm not sure what you mean by that. Can you provide an
example that doesn't behave as expected?

>   4. It looks like your "gen_close" does not try to throw a
>      GeneratorExit before calling close when delegating to a
>      non-generator.

I'm not sure what you mean here either. Regardless of the
type of sub-iterator, it should end up getting to the
part which does

	if (!PyErr_Occurred())
		PyErr_SetNone(PyExc_GeneratorExit);

Again, and example that doesn't behave properly would
help.

-- 
Greg




More information about the Python-ideas mailing list