Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed as not planned
Description
currently asyncio.iscoroutinefunction and inspect.iscoroutinefunction behave differently inconfusing and hard to document ways. It's possible to bring them into alignment but I think it would be better to makeasyncio.iscoroutinefunction a deprecated alias ofinspect.iscoroutinefunction and removeasyncio.coroutines._is_coroutine.
This is now possible with the recentremoval of@asyncio.coroutine and support forAsyncMock and other duck-type functions in inspect.iscoroutinefunction
the only caveats are - what should happen to users of theasyncio.coroutines._is_coroutine mark? eg:
Lines 686 to 696 in1c0cf0a
| @types.coroutine | |
| def_wrap_awaitable(awaitable): | |
| """Helper for asyncio.ensure_future(). | |
| Wraps awaitable (an object with __await__) into a coroutine | |
| that will later be wrapped in a Task by ensure_future(). | |
| """ | |
| return (yieldfromawaitable.__await__()) | |
| _wrap_awaitable._is_coroutine=_is_coroutine | |
and all of these:
Lib/test/test_asyncio/test_base_events.py: m_socket.getaddrinfo._is_coroutine = FalseLib/test/test_asyncio/test_base_events.py: self.loop._add_reader._is_coroutine = FalseLib/test/test_asyncio/test_base_events.py: self.loop._add_writer._is_coroutine = FalseLib/test/test_asyncio/test_base_events.py: self.loop._add_reader._is_coroutine = FalseLib/test/test_asyncio/test_base_events.py: self.loop._add_writer._is_coroutine = FalseLib/test/test_asyncio/test_base_events.py: self.loop._add_reader._is_coroutine = FalseLib/test/test_asyncio/test_base_events.py: self.loop._add_writer._is_coroutine = FalseLib/test/test_asyncio/test_base_events.py: m_socket.getaddrinfo._is_coroutine = FalseLib/test/test_asyncio/test_base_events.py: m_socket.getaddrinfo._is_coroutine = FalseLib/test/test_asyncio/test_base_events.py: self.loop._add_reader._is_coroutine = FalseLib/test/test_asyncio/test_selector_events.py: self.loop.add_reader._is_coroutine = FalseLib/test/test_asyncio/test_subprocess.py: protocol.connection_made._is_coroutine = FalseLib/test/test_asyncio/test_subprocess.py: protocol.process_exited._is_coroutine = FalseLib/unittest/mock.py: mock._is_coroutine = asyncio.coroutines._is_coroutineLib/unittest/mock.py: # iscoroutinefunction() checks _is_coroutine property to say if anLib/unittest/mock.py: self.__dict__['_is_coroutine'] = asyncio.coroutines._is_coroutineMetadata
Metadata
Assignees
Projects
Status
Done