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.

classification
Title: inspect.iscoroutine returns False for asynchronous generator methods
Type: behavior Stage: resolved
Components: asyncio, Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, kumaraditya, plammens, xtreak, yselivanov
Priority: normal Keywords:

Created on 2020-12-27 20:41 by plammens, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg383862 - (view) Author: Paolo Lammens (plammens) * Date: 2020-12-27 20:41
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
```
msg414111 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2022-02-26 16:24
This seems to be a duplicate of https://bugs.python.org/issue37190
History
Date User Action Args
2022-04-11 14:59:39adminsetgithub: 86926
2022-03-12 17:28:18asvetlovsetstatus: open -> closed
resolution: duplicate
stage: resolved
2022-02-26 16:24:54xtreaksetnosy: + xtreak
messages: + msg414111
2022-02-26 14:51:05kumaradityasetnosy: + kumaraditya
2020-12-30 12:40:13plammenssettitle: inspect.iscoroutine returns False for asynchronous generator functions -> inspect.iscoroutine returns False for asynchronous generator methods
2020-12-30 12:39:46plammenssetversions: + Python 3.9
2020-12-27 20:41:27plammenscreate