8000 gh-94597: deprecate asyncio.set_event_loop_policy by graingert · Pull Request #110728 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-94597: deprecate asyncio.set_event_loop_policy #110728

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

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
deprecate asyncio.set_event_loop_policy
  • Loading branch information
graingert committed Oct 11, 2023
commit a1fa65776c3f0cefc9a67a0463251029a2deb6bf
4 changes: 4 additions & 0 deletions Lib/asyncio/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import subprocess
import sys
import threading
import warnings

from . import format_helpers

Expand Down Expand Up @@ -787,6 +788,9 @@ def set_event_loop_policy(policy):
"""Set the current event loop policy.

If policy is None, the default policy is restored."""
warnings._deprecated("set_event_loop_policy",
"{name!r} is deprecated as of Python 3.13 and will be "
"removed in Python {remove}.", remove=(3, 15))
global _event_loop_policy
if policy is not None and not isinstance(policy, AbstractEventLoopPolicy):
raise TypeError(f"policy must be an instance of AbstractEventLoopPolicy or None, not '{type(policy).__name__}'")
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
0