homepage

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 scoder
Recipients gvanrossum, scoder, vstinner, yselivanov
Date 2015年05月30日.09:26:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1432977992.53.0.617864311577.issue24004@psf.upfronthosting.co.za>
In-reply-to
Content
I found one more place in asyncio.coroutines, around line 190 in the coroutine() decorator:
 if inspect.isgeneratorfunction(func):
 coro = func
 else:
 @functools.wraps(func)
 def coro(*args, **kw):
 res = func(*args, **kw)
 if isinstance(res, futures.Future) or inspect.isgenerator(res):
 res = yield from res
 return res
The wrapped isgenerator() check should be replaced by an Awaitable ABC check, e.g. this works for me:
"""
 res = func(*args, **kw)
 if isinstance(res, futures.Future) or inspect.isgenerator(res):
 res = yield from res
+ else:
+ await_res = getattr(res, '__await__', None)
+ if await_res is not None:
+ res = yield from await_res()
 return res
"""
History
Date User Action Args
2015年05月30日 09:26:32scodersetrecipients: + scoder, gvanrossum, vstinner, yselivanov
2015年05月30日 09:26:32scodersetmessageid: <1432977992.53.0.617864311577.issue24004@psf.upfronthosting.co.za>
2015年05月30日 09:26:32scoderlinkissue24004 messages
2015年05月30日 09:26:32scodercreate

AltStyle によって変換されたページ (->オリジナル) /