Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for inspect.iscoroutinefunction() for Coroutine provider #830

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ZipFile
Copy link
Contributor

@ZipFile ZipFile commented Nov 5, 2024

This improves Python 3.12+ support.

Background:
@asyncio.coroutine is no longer available since 3.11, asyncio.iscoroutinefunction() was a helper function to detect generator-based coroutines, i.e. functions marked with @asyncio.coroutine decorator, which set _is_coroutine attribute. This implementation detail was historically abused to mark sync functions returning awaitables.
Since 3.12, inspect.markcoroutinefunction() is a preferred way to mark sync functions returning awaitables. It is intended to be used with inspect.iscoroutinefunction(). Given the fact that we're in Cython realm, we have to resort to less graceful solution and go deeper by abusing implementation details, again.

Note:
asyncio.iscoroutinefunction() will be deprecated in 3.16, so old marker is still in place for better compatibility.

@ZipFile ZipFile changed the title Add support for inspect.iscoroutinefunction() in Coroutine provider Add support for inspect.iscoroutinefunction() for Coroutine provider Nov 5, 2024
@ZipFile ZipFile changed the base branch from master to develop November 10, 2024 16:30
@ZipFile ZipFile marked this pull request as draft November 10, 2024 22:04
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.

1 participant