summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/tasks.py
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2023-06-13 06:06:40 (GMT)
committerGitHub <noreply@github.com>2023-06-13 06:06:40 (GMT)
commit840d02f3f0cd341207db6d918ce7f0987be9952e (patch)
treebd456e3ea504d4a1e3ad0e270147d96d5f045b65 /Lib/asyncio/tasks.py
parent829ac13b69a2b53153e1b40670e6ef82f05130c1 (diff)
downloadcpython-840d02f3f0cd341207db6d918ce7f0987be9952e.zip
cpython-840d02f3f0cd341207db6d918ce7f0987be9952e.tar.gz
cpython-840d02f3f0cd341207db6d918ce7f0987be9952e.tar.bz2
GH-105684: Require `asyncio.Task` implementations to support `set_name` method (#105685)
Diffstat (limited to 'Lib/asyncio/tasks.py')
-rw-r--r--Lib/asyncio/tasks.py15
1 files changed, 1 insertions, 14 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index 4250bb0..75dd3cb 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -68,19 +68,6 @@ def all_tasks(loop=None):
if futures._get_loop(t) is loop and not t.done()}
-def _set_task_name(task, name):
- if name is not None:
- try:
- set_name = task.set_name
- except AttributeError:
- 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)
-
-
class Task(futures._PyFuture): # Inherit Python Task implementation
# from a Python Future implementation.
@@ -412,7 +399,7 @@ def create_task(coro, *, name=None, context=None):
else:
task = loop.create_task(coro, context=context)
- _set_task_name(task, name)
+ task.set_name(name)
return task