[New-bugs-announce] [issue41174] asyncio.coroutine decorator returns a non-generator function when using PYTHONASYNCIODEBUG
Allan Feldman
report at bugs.python.org
Tue Jun 30 13:14:21 EDT 2020
New submission from Allan Feldman <allan.d.feldman at gmail.com>:
This code behaves differently when PYTHONASYNCIODEBUG=1
import asyncio
import inspect
@asyncio.coroutine
def foo():
yield from asyncio.sleep(0)
print("isgeneratorfunction:", inspect.isgeneratorfunction(foo))
PYTHONASYNCIODEBUG:
isgeneratorfunction: False
non-debug mode:
isgeneratorfunction: True
When in debug mode, the `asyncio.coroutine` decorator returns a function that is not a generator function (https://github.com/python/cpython/blob/bd4a3f21454a6012f4353e2255837561fc9f0e6a/Lib/asyncio/coroutines.py#L144)
The result is that introspection of functions is changed when PYTHONASYNCIODEBUG is enabled.
----------
components: asyncio
messages: 372706
nosy: a-feld, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.coroutine decorator returns a non-generator function when using PYTHONASYNCIODEBUG
type: behavior
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41174>
_______________________________________
More information about the New-bugs-announce
mailing list