syrusakbary / promise

Ultra-performant Promise implementation in Python
MIT License
362 stars 76 forks source link

Generator-based coroutines aren't recognized in 2.2.1 #69

Open insolite opened 5 years ago

insolite commented 5 years ago

Since https://github.com/syrusakbary/promise/commit/90093a1ca51fac25e0f92f78fe7f33b697bf1629 the iscoroutine from inspect is used which is quite different to asyncio's. According to docs it recognizes async def. But it doesn't return true for @asyncio.coroutine functions. For them there's an isawaitable. Shouldn't it be used instead of inspect.iscoroutine? Also the inspect.iscoroutine is new in 3.5 so shouldn't we keep the asyncio.iscoroutine as a fallback option instead of removing it at all (seems like it breaks 3.4 compatibility).