[issue38225] iscoroutinefunction broken with cython - allow tagging of functions as async?

Stefan Behnel report at bugs.python.org
Sat Sep 21 09:23:26 EDT 2019


Stefan Behnel <stefan_ml at behnel.de> added the comment:

> along with the appropriate CO_COROUTINE flag set

No, it never did that, for safety reasons. It's difficult to say if enabling these flags is the right thing to do, because it's unclear what assumptions code that tests for them would make. In CPython itself, there do not seem to be any "excessive" assumptions specific to that flag – also because Cython functions are not Python functions, and thus the flag will never be looked at:

https://github.com/python/cpython/blob/5b9ff7a0dcb16d6f5c3cd4f1f52e0ca6a4bde586/Lib/inspect.py#L178-L180

Thus, setting the CO_COROUTINE and CO_ASYNC_GENERATOR code flags has no effect for Cython functions.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38225>
_______________________________________


More information about the Python-bugs-list mailing list