-
-
Notifications
You must be signed in to change notification settings - Fork 749
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
use asyncio.run(..., loop_factory) to avoid asyncio.set_event_loop_policy #2130
base: master
Are you sure you want to change the base?
Conversation
ee26ddb
to
12c6f54
Compare
|
||
import uvloop | ||
|
||
|
||
def uvloop_setup(use_subprocess: bool = False) -> None: | ||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) |
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.
uvloop.EventLoopPolicy is deprecated
uvicorn/loops/asyncio.py
Outdated
|
||
logger = logging.getLogger("uvicorn.error") | ||
|
||
|
||
def asyncio_setup(use_subprocess: bool = False) -> None: | ||
if sys.platform == "win32" and use_subprocess: | ||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) |
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.
set_event_loop_policy will be deprecated in python 3.13
This still needs a doc change |
actually this doesn't need a doc change as |
f6f7a27
to
6450a87
Compare
6450a87
to
849169f
Compare
Summary
set_event_loop_policy will be deprecated in python 3.13 and uvloop.EventLoopPolicy is deprecated already, this backports and uses the preferred
loop_factory
keyword to configure asyncio.runChecklist