This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients gvanrossum, ncoghlan, pitrou
Date 2010-10-29.01:28:37
SpamBayes Score 0.00056615425
Marked as misclassified No
Message-id <1288315720.11.0.959117032588.issue10220@psf.upfronthosting.co.za>
In-reply-to
Content
Indeed, the minimal lifecycles are:

GEN_CREATED->GEN_CLOSED (exception thrown in before the generator was even started)
GEN_CREATED->GEN_RUNNING->GEN_CLOSED (initial next() with internal logic that skips all yields)
GEN_CREATED->GEN_RUNNING->GEN_SUSPENDED->GEN_RUNNING->GEN_CLOSED (initial next() with a throw, next or send to close it)

Other cases following the same basic pattern as the last one, they just bounce back and forth between suspended and running more times.

It occurred to me that threads really use the same state machine, it's just that almost nobody writes their own Python thread schedulers, so only _thread and threading care about the suspended/running distinction. There are quite a few different generator schedulers though, so the distinctions matters to more 3rd party code than it does for threads.
History
Date User Action Args
2010-10-29 01:28:40ncoghlansetrecipients: + ncoghlan, gvanrossum, pitrou
2010-10-29 01:28:40ncoghlansetmessageid: <1288315720.11.0.959117032588.issue10220@psf.upfronthosting.co.za>
2010-10-29 01:28:37ncoghlanlinkissue10220 messages
2010-10-29 01:28:37ncoghlancreate