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 yselivanov
Recipients Ben.Darnell, Yury.Selivanov, asvetlov, gvanrossum, ncoghlan, scoder, vstinner, yselivanov
Date 2015-06-10.05:10:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> GeneratorWrapper helps, but it fails when applied to non-generator functions that return a value (while both tornado.gen.coroutine and asyncio.coroutine take pains to support such usage). The "raise TypeError" should be removed; just return the result without wrapping if it's not a generator. 

I think this is reasonable.  I'll try it tomorrow to see if there are any corner cases, but I doubt there are any.

> GeneratorWrapper also runs afoul of some places where I do explicit type checking instead of duck typing (isinstance(x, types.GeneratorType)). Using the Generator ABC doesn't work because the generator methods are set as attributes on __init__ instead of defined on the class. The methods should be defined on the class, even if they're overwritten with instance attributes later for speed.  

Sure, this can be fixed too.  

Could you please update types.coroutine locally and verify that it will work for Tornado?

> (related: inspect.iscoroutine is defined in terms of Should inspect.isgenerator be redefined to use the new

Since abc.Generator is a new thing I guess we still can do that.  Do you have a good use case for it?  We need a good one to convince Larry to include this post-beta.
Date User Action Args
2015-06-10 05:10:17yselivanovsetrecipients: + yselivanov, gvanrossum, ncoghlan, scoder, vstinner, asvetlov, Yury.Selivanov, Ben.Darnell
2015-06-10 05:10:17yselivanovsetmessageid: <>
2015-06-10 05:10:17yselivanovlinkissue24400 messages
2015-06-10 05:10:17yselivanovcreate