New submission from David Hilton <dhilt...@gmail.com>:

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.

----------
components: asyncio
messages: 352812
nosy: asvetlov, dhiltonp, yselivanov
priority: normal
severity: normal
status: open
title: iscoroutinefunction broken with cython - allow tagging of functions as 
async?
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38225>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to