[New-bugs-announce] [issue42760] inspect.iscoroutine returns False for asynchronous generator functions
Paolo Lammens
report at bugs.python.org
Sun Dec 27 15:41:27 EST 2020
New submission from Paolo Lammens <lammenspaolo at gmail.com>:
The `inspect.iscoroutinefunction` and `inspect.iscoroutine` functions return `False` for the `asend`, `athrow` and `aclose` methods of asynchronous generators (PEP 525). These are coroutine functions (i.e. one does e.g. `await gen.asend(value)`) so I would have expected these to return `True`.
Example:
```python
async def generator():
return
yield
```
```python
>>> import inspect
>>> g = generator()
>>> inspect.iscoroutinefunction(g.asend)
False
>>> inspect.iscoroutine(g.asend(None))
False
```
----------
components: Library (Lib), asyncio
messages: 383862
nosy: asvetlov, plammens, yselivanov
priority: normal
severity: normal
status: open
title: inspect.iscoroutine returns False for asynchronous generator functions
type: behavior
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42760>
_______________________________________
More information about the New-bugs-announce
mailing list