[issue44928] async generator missing unawaited coroutine warning
Thomas Grainger
report at bugs.python.org
Mon Aug 16 17:29:12 EDT 2021
New submission from Thomas Grainger <tagrain at gmail.com>:
demo program:
```
def test_async_fn():
async def async_fn():
pass
async_fn()
def test_async_gen_fn():
async def agen_fn():
yield
agen_fn().aclose()
agen_fn().asend(None)
test_async_fn()
test_async_gen_fn()
```
output:
```
/home/graingert/projects/anyio/foo.py:5: RuntimeWarning: coroutine 'test_async_fn.<locals>.async_fn' was never awaited
async_fn()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
```
expected:
```
/home/graingert/projects/anyio/foo.py:5: RuntimeWarning: coroutine 'test_async_fn.<locals>.async_fn' was never awaited
async_fn()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/home/graingert/projects/anyio/foo.py:12: RuntimeWarning: coroutine '<async_generator_athrow object at 0xffffffffffff>' was never awaited
agen_fn().aclose()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/home/graingert/projects/anyio/foo.py:13: RuntimeWarning: coroutine '<async_generator_asend object at 0xffffffffffff>' was never awaited
agen_fn().asend(None)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
```
----------
components: Interpreter Core
messages: 399684
nosy: graingert
priority: normal
severity: normal
status: open
title: async generator missing unawaited coroutine warning
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44928>
_______________________________________
More information about the Python-bugs-list
mailing list