diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2022-03-13 16:34:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-13 16:34:46 (GMT) |
commit | 7e473e94a52024ac821dd2f206290423e4987ead (patch) | |
tree | b3038fa3d4e7a8a3a21dee1d28614a849ad6b9f8 /Lib | |
parent | 3543ddb4c4ebc26fb2d6c67a97e66f5267876f72 (diff) | |
download | cpython-7e473e94a52024ac821dd2f206290423e4987ead.zip cpython-7e473e94a52024ac821dd2f206290423e4987ead.tar.gz cpython-7e473e94a52024ac821dd2f206290423e4987ead.tar.bz2 |
bpo-46995: Deprecate missing asyncio.Task.set_name() for third-party task implementations (GH-31838)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/asyncio/tasks.py | 5 | ||||
-rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 059143f..e604298 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -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) diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 9508792..95fabf7 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -12,7 +12,6 @@ import sys import textwrap import traceback import unittest -import weakref from unittest import mock from types import GenericAlias |