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>
This commit is contained in:
Andrew Svetlov 2022-03-13 18:34:46 +02:00 committed by GitHub
parent 3543ddb4c4
commit 7e473e94a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View file

@ -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)