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.

Author a-feld
Recipients a-feld, asvetlov, yselivanov
Date 2020-06-30.17:14:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593537261.43.0.523552907091.issue41174@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-06-30 17:14:21a-feldsetrecipients: + a-feld, asvetlov, yselivanov
2020-06-30 17:14:21a-feldsetmessageid: <1593537261.43.0.523552907091.issue41174@roundup.psfhosted.org>
2020-06-30 17:14:21a-feldlinkissue41174 messages
2020-06-30 17:14:21a-feldcreate