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

Fix DeprecationWarning when calling asyncio.get_event_loop() #32533

Merged
merged 1 commit into from
Mar 4, 2023

Conversation

XuanWang-Amos
Copy link
Contributor

@XuanWang-Amos XuanWang-Amos commented Mar 3, 2023

Fix: #32526 (comment)

Context:

Calling asyncio.get_event_loop() without an running loop will emitted a DeprecationWarning, in this case, we should call asyncio.get_event_loop_policy().get_event_loop() to get the loop.

@XuanWang-Amos XuanWang-Amos added release notes: yes Indicates if PR needs to be in release notes lang/Python python Pull requests that update Python code labels Mar 3, 2023
@XuanWang-Amos XuanWang-Amos marked this pull request as ready for review March 3, 2023 20:25
@XuanWang-Amos XuanWang-Amos merged commit 95d6325 into grpc:master Mar 4, 2023
@XuanWang-Amos XuanWang-Amos deleted the fixEventLoop branch March 4, 2023 00:36
@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Mar 8, 2023
XuanWang-Amos added a commit to XuanWang-Amos/grpc that referenced this pull request May 1, 2023
)

Fix: grpc#32526 (comment)

### Context:
Calling `asyncio.get_event_loop()` [without an running loop will emitted
a
DeprecationWarning](https://docs.python.org/3.10/library/asyncio-eventloop.html#asyncio.get_event_loop),
in this case, we should call
`asyncio.get_event_loop_policy().get_event_loop()` to get the loop.
wanlin31 pushed a commit that referenced this pull request May 18, 2023
Fix: #32526 (comment)

### Context:
Calling `asyncio.get_event_loop()` [without an running loop will emitted
a
DeprecationWarning](https://docs.python.org/3.10/library/asyncio-eventloop.html#asyncio.get_event_loop),
in this case, we should call
`asyncio.get_event_loop_policy().get_event_loop()` to get the loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported Specifies if the PR has been imported to the internal repository lang/Python python Pull requests that update Python code release notes: yes Indicates if PR needs to be in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate warnings from asyncio.get_running_loop in python 3.10+
2 participants