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

2020-09-22 Thread Stefan Behnel
Stefan Behnel added the comment: FYI, https://github.com/cython/cython/pull/3427 has been merged into Cython. In Cython 3.0, compiled coroutines will disguise as non-compiled coroutines, from the PoV of asyncio. Restricting this ticket to Py3.10 since we're rather discussing a new feature

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

2019-12-24 Thread Andrew Svetlov
Andrew Svetlov added the comment: I'd like to hear Yuri's opinion for the idea of adding an attribute. Another question is the name: I have proposed __awaitable__ but maybe __async__ is slightly better? -- ___ Python tracker

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

2019-12-23 Thread Stefan Behnel
Stefan Behnel added the comment: FWIW, it seems reasonable to have a protocol for this. -- ___ Python tracker ___ ___

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

2019-12-10 Thread Fabio Pugliese Ornellas
Fabio Pugliese Ornellas added the comment: It is worth noting that test frameworks can greatly benefit from iscoroutinefunction to work. I'm the main author of TestSlide, which provides more strict mocking for Python. I recently added async support, so we can detect bugs such as

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

2019-09-21 Thread Stefan Behnel
Stefan Behnel 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,

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

2019-09-20 Thread Yury Selivanov
Yury Selivanov added the comment: > If a python piece of code imports cython code with async defs, > `asyncio.iscoroutinefunction` cannot determine that the code is async. Well, this seems to be a regression. IIRC Cython used to emulate a Python code object (__code__) for functions it

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

2019-09-20 Thread Emmanuel Arias
Change by Emmanuel Arias : -- nosy: +eamanu ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2019-09-20 Thread Andrew Svetlov
Andrew Svetlov added the comment: I think `func.__awaitable__ = True` can serve all possible situations. We need it for async mocks (now the library use flawless `_is_coroutine` approach. `__awaitable__` can also cover cases where a regular function returns awaitable object or there is a

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

2019-09-19 Thread Stefan Behnel
Stefan Behnel added the comment: My usual first reaction is: "if you need to find out whether the return value of a callable will be an Awaitable or not, without calling it, then you're probably doing something wrong in your design". However, a) there is code that tries this already (and it

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

2019-09-19 Thread Andrew Svetlov
Andrew Svetlov added the comment: I think we need better name than just `_is_coroutine`. All async function properties as dunder named, the new *official* name should follow this convention as well -- ___ Python tracker

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

2019-09-19 Thread Zachary Ware
Change by Zachary Ware : -- nosy: +scoder versions: -Python 2.7, Python 3.5, Python 3.6 ___ Python tracker ___ ___

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

2019-09-19 Thread David Hilton
Change by David Hilton : -- keywords: +patch pull_requests: +15877 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16292 ___ Python tracker ___

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

2019-09-19 Thread David Hilton
New submission from David Hilton : 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