[New-bugs-announce] [issue24004] avoid explicit generator type check in asyncio
report at bugs.python.org
Sun Apr 19 12:21:02 CEST 2015
New submission from Stefan Behnel:
asyncio/coroutines.py contains this code:
_COROUTINE_TYPES = (types.GeneratorType, CoroWrapper)
"""Return True if obj is a coroutine object."""
return isinstance(obj, _COROUTINE_TYPES)
In other places, it uses inspect.isgenerator() to do the same thing. This is inconsistent and should be changed. Code that wants to patch inspect.isgenerator() in order to support other generator types shouldn't also have to patch asyncio directly, and code that wants to support other generator types in asyncio shouldn't have to patch both places either.
nosy: gvanrossum, haypo, scoder, yselivanov
title: avoid explicit generator type check in asyncio
versions: Python 3.4, Python 3.5
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce