Skip to content

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

Open
encukou wants to merge 2 commits into
pydanny:mainfrom
encukou:py3.11
Open

Python 3.11 support: Don't use asyncio.coroutine if it's not available#267
encukou wants to merge 2 commits into
pydanny:mainfrom
encukou:py3.11

Conversation

@encukou

@encukou encukou commented Dec 2, 2021

Copy link
Copy Markdown

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.

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.
This is	still necessary	according to the Contributing Guidelines.
@AdamWill

AdamWill commented Nov 5, 2024

Copy link
Copy Markdown
Contributor

I rebased this against 2.0.1 as #359 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants