Skip to content
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.