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

Deprecate asyncio.iscoroutinefunction #122858

Closed
kumaraditya303 opened this issue Aug 9, 2024 · 4 comments
Closed

Deprecate asyncio.iscoroutinefunction #122858

kumaraditya303 opened this issue Aug 9, 2024 · 4 comments
Labels
3.14 new features, bugs and security fixes topic-asyncio

Comments

@kumaraditya303
Copy link
Contributor

kumaraditya303 commented Aug 9, 2024

asyncio.iscoroutinefunction should be deprecated in favor of inspect.iscoroutinefunction, we don't need two different functions to do the same thing. I propose to deprecate asyncio.iscoroutinefunction because IMO these introspection functions don't belong to asyncio but more to inspect module. It will be deprecated in Python 3.14 and scheduled for removal in Python 3.16.

Linked PRs

@kumaraditya303 kumaraditya303 added topic-asyncio 3.14 new features, bugs and security fixes labels Aug 9, 2024
@github-project-automation github-project-automation bot moved this to Todo in asyncio Aug 9, 2024
@Wulian233
Copy link
Contributor

Wulian233 commented Aug 9, 2024

See #94923 , maybe you can review it :)

@Eclips4
Copy link
Member

Eclips4 commented Aug 9, 2024

Looks like an duplicate of #94912

@kumaraditya303
Copy link
Contributor Author

Looks like an duplicate of #94912

No it isn't, in this issue we are just deprecating it not making an alias.

kumaraditya303 added a commit that referenced this issue Aug 11, 2024
Deprecate `asyncio.iscoroutinefunction` in favor of `inspect.iscoroutinefunction`.

Co-authored-by: Kumar Aditya <[email protected]>
@github-project-automation github-project-automation bot moved this from Todo to Done in asyncio Aug 11, 2024
blhsing pushed a commit to blhsing/cpython that referenced this issue Aug 22, 2024
Deprecate `asyncio.iscoroutinefunction` in favor of `inspect.iscoroutinefunction`.

Co-authored-by: Kumar Aditya <[email protected]>
@illia-v
Copy link
Contributor

illia-v commented Nov 9, 2024

If you get the deprecation error and want to support Python < 3.12, you may need to still use asyncio.iscoroutinefunction conditionally for backward compatibility because before #94050 merged into 3.12 (and only some 3.10 and 3.11 releases) the functions hadn't been equivalent

if sys.version_info >= (3, 12):
    iscoroutinefunction = inspect.iscoroutinefunction
else:
    iscoroutinefunction = asyncio.iscoroutinefunction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 new features, bugs and security fixes topic-asyncio
Projects
Status: Done
Development

No branches or pull requests

4 participants