-
Notifications
You must be signed in to change notification settings - Fork 605
replace all asyncio.iscoroutinefunction with inspect.iscoroutinefunction
#5928
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've reviewed this pull request using the Sourcery rules engine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses Python 3.14 deprecation warnings by replacing all instances of asyncio.iscoroutinefunction with inspect.iscoroutinefunction. The deprecated function is scheduled for removal in Python 3.16.
- Replaced all 11 occurrences of
asyncio.iscoroutinefunctionwithinspect.iscoroutinefunction - Added
import inspectto all affected files that didn't already have it - No functional changes to the logic - this is a direct drop-in replacement
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sdk/python/packages/flet/src/flet/testing/flet_test_app.py | Added inspect import and replaced deprecated function call when checking if __flet_app_main is a coroutine |
| sdk/python/packages/flet/src/flet/pubsub/pubsub_hub.py | Added inspect import and replaced deprecated function call when determining handler type in __send method |
| sdk/python/packages/flet/src/flet/messaging/session.py | Added inspect import and replaced deprecated function calls (2 occurrences) when checking hook setup/cleanup functions |
| sdk/python/packages/flet/src/flet/messaging/pyodide_connection.py | Added inspect import and replaced deprecated function call when checking __before_main callback |
| sdk/python/packages/flet/src/flet/messaging/flet_socket_server.py | Added inspect import and replaced deprecated function call when checking __before_main callback |
| sdk/python/packages/flet/src/flet/controls/page.py | Added inspect import and replaced deprecated function calls (4 occurrences) for checking coroutine handlers in run_task, login, _authorize_callback, and logout methods |
| sdk/python/packages/flet/src/flet/controls/base_control.py | Replaced deprecated function call when checking event handler type in _trigger_event method (already had inspect imported) |
| sdk/python/packages/flet/src/flet/app.py | Replaced deprecated function call when checking main function type in on_session_created (already had inspect imported) |
| sdk/python/packages/flet-web/src/flet_web/fastapi/flet_fastapi.py | Added inspect import and replaced deprecated function calls (2 occurrences) when checking startup/shutdown handlers |
| sdk/python/packages/flet-web/src/flet_web/fastapi/flet_app.py | Replaced deprecated function calls (2 occurrences) when checking main and before_main functions (already had inspect imported) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sdk/python/packages/flet-web/src/flet_web/fastapi/flet_fastapi.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
|
Any updates? |
ndonkoHenri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Description
This PR will replace all instances of
asyncio.iscoroutinefunctionin the codebase withinspect.iscoroutinefunction, because the former was marked as deprecated in Python 3.14 and will be removed in Python 3.16.Fixes #5927
Test Code
# Test code for the review of this PRType of change
Checklist
Screenshots
Additional details
Summary by Sourcery
Enhancements: