Skip to content

bpo-46995: Deprecate missing asyncio.Task.set_name() for third-party task implementations #31838

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

Merged
merged 6 commits into from
Mar 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion Lib/asyncio/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def _set_task_name(task, name):
try:
set_name = task.set_name
except AttributeError:
pass
warnings.warn("Task.set_name() was added in Python 3.8, "
"the method support will be mandatory for third-party "
"task implementations since 3.13.",
DeprecationWarning, stacklevel=3)
else:
set_name(name)

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import textwrap
import traceback
import unittest
import weakref
from unittest import mock
from types import GenericAlias

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Deprecate missing :meth:`asyncio.Task.set_name` for third-party task
implementations, schedule making it mandatory in Python 3.13.