On Thu, Mar 30, 2017 at 11:05 AM, Oleg Nesterov email@example.com wrote:
On 03/28, Eric Snow wrote:
On Mon, Mar 20, 2017 at 11:30 AM, Oleg Nesterov firstname.lastname@example.org wrote:
Let me first clarify, I do not claim this is a bug, I am trying to learn python and now I trying to understand yield-from.
Given that you haven't gotten a response here,
and this looks a bit strange. My question is simple, the implementation looks clear and straightforward, I am a bit surprised none of cpython devs bothered to reply.
you may want to take this over to the email@example.com list.
Well, I'm afraid to contact this closed and not-for-mortals list, not sure this very basic question should go there ;) perhaps you are already a member, feel free to forward.
core-mentorship is intended as a friendly place for folks who are starting to study CPython internals. I'm not sure where you got the impression that it's not-for-mortals but I suspect the people running it would like to know so they can fix it :-).
In any case the short answer to your original question is that PEP 342 says that generator finalization calls the generator's close() method, which throws a GeneratorExit into the generator, and PEP 380 says that as a special case, when a GeneratorExit is thrown into a yield from, then this is propagated by calling .close() on the yielded-from iterator (if such a method exists) and then re-raised in the original generator.