New submission from Stefan Behnel:

asyncio/coroutines.py contains this code:

"""
_COROUTINE_TYPES = (types.GeneratorType, CoroWrapper)

def iscoroutine(obj):
    """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.

----------
components: asyncio
messages: 241506
nosy: gvanrossum, haypo, scoder, yselivanov
priority: normal
severity: normal
status: open
title: avoid explicit generator type check in asyncio
type: behavior
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24004>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to