mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
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:
parent
3543ddb4c4
commit
7e473e94a5
3 changed files with 6 additions and 2 deletions
|
@ -67,7 +67,10 @@ def _set_task_name(task, name):
|
||||||
try:
|
try:
|
||||||
set_name = task.set_name
|
set_name = task.set_name
|
||||||
except AttributeError:
|
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:
|
else:
|
||||||
set_name(name)
|
set_name(name)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
import traceback
|
import traceback
|
||||||
import unittest
|
import unittest
|
||||||
import weakref
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from types import GenericAlias
|
from types import GenericAlias
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Deprecate missing :meth:`asyncio.Task.set_name` for third-party task
|
||||||
|
implementations, schedule making it mandatory in Python 3.13.
|
Loading…
Add table
Add a link
Reference in a new issue