Skip to content

Replace deprecated asyncio.iscoroutinefunction with inspect.iscoroutinefunction #13890

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

edgarrmondragon
Copy link

Deprecated in Python 3.14 and will be removed in Python 3.16.

@YuriiMotov
Copy link
Contributor

@edgarrmondragon, thanks for your interest!

I think it's early to do this refactor. We don't have any warning and without it we will miss occurrences of asyncio.iscoroutinefunction in new PRs and merge them.

Do you think it's right time for this? I think we can wait till FastAPI supports Python 3.16 or other versions start to emit deprecation warnings

@edgarrmondragon
Copy link
Author

I think it's early to do this refactor. We don't have any warning and without it we will miss occurrences of asyncio.iscoroutinefunction in new PRs and merge them. Do you think it's right time for this?

That's a good point. Final release of Python 3.14.0 is scheduled for 2025-10-07, and the first RC is only a little over a week away at this point, so I think

  • the short time frame
  • the fact that more people will start testing their FastAPI apps with Python 3.14 in the coming weeks now that pydantic-core supports it (that's how I discovered this)
  • there's no functional differences between the two methods

are good reasons to do this at this point.

I think we can wait till FastAPI supports Python 3.16 or other versions start to emit deprecation warnings

If you want to wait, the earliest I'd recommend is when final 3.14.0 comes out, but that's of course completely up to you.

Copy link
Contributor

@YuriiMotov YuriiMotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should wait until all pending PRs (or most of them) have been reviewed and merged, then make sure we haven't introduced any new cases where deprecated call is used and then merge this.
Also, we need to check for other deprecated methods used as well.

I think this will happen automatically when Python 3.16 is released and FastAPI officially supports it (will start running tests on Python 3.16)

OrangeDoro

This comment was marked as off-topic.

@YuriiMotov

This comment was marked as off-topic.

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.

3 participants