cached-property icon indicating copy to clipboard operation
cached-property copied to clipboard

Python 3.11 support: Don't use asyncio.coroutine if it's not available

Open encukou opened this issue 2 years ago • 0 comments

Python 3.11 drops the deprecated @asyncio.coroutine and asyncio.iscoroutinefunction.

Using a wrapper with @asyncio.coroutine in __get__ wasn't necessary (the future from asyncio.ensure_future is awaitable, and the wrapper doesn't do anything asynchronous), so the logic can be simplified to just call asyncio.ensure_future (to schedule the task and store the result when it's available).

Tests for @asyncio.coroutine are skipped on 3.11+.

An unnecessary call to asyncio.coroutine in tests is removed: it's not necessary to call this for async def functions.

encukou avatar Dec 02 '21 10:12 encukou