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 dhiltonp
Recipients asvetlov, dhiltonp, yselivanov
Date 2019-09-19.18:38:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1568918319.91.0.348855638851.issue38225@roundup.psfhosted.org>
In-reply-to
Content
If a python piece of code imports cython code with async defs, `asyncio.iscoroutinefunction` cannot determine that the code is async.

https://github.com/cython/cython/issues/2273#issuecomment-531537624

scoder is open to marking async defs so that they can be identified, just like `asyncio.coroutine`:

https://github.com/python/cpython/blob/ae239f6b0626e926613a4a1dbafa323bd41fec32/Lib/asyncio/coroutines.py#L156

However, that is an internal interface and `@coroutine` is deprecated.

--------------

Can we have some official way of marking functions as async that will not be deprecated?

The easiest would be for `asyncio.iscoroutinefunction` to look for `_is_coroutine = True`, and promise to keep looking for that value.

This would also allow for functools.partial to easily mark that it's returning an async function, which some people seem to care about.
History
Date User Action Args
2019-09-19 18:38:39dhiltonpsetrecipients: + dhiltonp, asvetlov, yselivanov
2019-09-19 18:38:39dhiltonpsetmessageid: <1568918319.91.0.348855638851.issue38225@roundup.psfhosted.org>
2019-09-19 18:38:39dhiltonplinkissue38225 messages
2019-09-19 18:38:39dhiltonpcreate