Skip to content

Commit f497b0b

Browse files
authored
Improve deprecation messages for backported deprecations (#16062)
1 parent d0d2a7e commit f497b0b

25 files changed

Lines changed: 51 additions & 51 deletions

stdlib/argparse.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class _ActionsContainer:
103103
conflict_handler: str = ...,
104104
) -> _ArgumentGroup: ...
105105
@overload
106-
@deprecated("The `prefix_chars` parameter deprecated since Python 3.14.")
106+
@deprecated("The `prefix_chars` parameter is deprecated.")
107107
def add_argument_group(
108108
self,
109109
title: str | None = None,
@@ -530,7 +530,7 @@ class Namespace(_AttributeHolder):
530530
def __eq__(self, other: object) -> bool: ...
531531
__hash__: ClassVar[None] # type: ignore[assignment]
532532

533-
@deprecated("Deprecated since Python 3.14. Open files after parsing arguments instead.")
533+
@deprecated("Deprecated; may leave files open. Open files after parsing arguments instead.")
534534
class FileType:
535535
# undocumented
536536
_mode: str
@@ -556,7 +556,7 @@ class _ArgumentGroup(_ActionsContainer):
556556
conflict_handler: str = ...,
557557
) -> None: ...
558558
@overload
559-
@deprecated("Undocumented `prefix_chars` parameter is deprecated since Python 3.14.")
559+
@deprecated("Undocumented `prefix_chars` parameter is deprecated.")
560560
def __init__(
561561
self,
562562
container: _ActionsContainer,

stdlib/asyncio/coroutines.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ def iscoroutine(obj: object) -> TypeIs[Coroutine[Any, Any, Any]]: ...
2121

2222
if sys.version_info >= (3, 11):
2323
@overload
24-
@deprecated("Deprecated since Python 3.14. Use `inspect.iscoroutinefunction()` instead.")
24+
@deprecated("Deprecated; will be removed in Python 3.16. Use `inspect.iscoroutinefunction()` instead.")
2525
def iscoroutinefunction(func: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ...
2626
@overload
27-
@deprecated("Deprecated since Python 3.14. Use `inspect.iscoroutinefunction()` instead.")
27+
@deprecated("Deprecated; will be removed in Python 3.16. Use `inspect.iscoroutinefunction()` instead.")
2828
def iscoroutinefunction(func: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, _T]]]: ...
2929
@overload
30-
@deprecated("Deprecated since Python 3.14. Use `inspect.iscoroutinefunction()` instead.")
30+
@deprecated("Deprecated; will be removed in Python 3.16. Use `inspect.iscoroutinefunction()` instead.")
3131
def iscoroutinefunction(func: Callable[_P, object]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, Any]]]: ...
3232
@overload
33-
@deprecated("Deprecated since Python 3.14. Use `inspect.iscoroutinefunction()` instead.")
33+
@deprecated("Deprecated; will be removed in Python 3.16. Use `inspect.iscoroutinefunction()` instead.")
3434
def iscoroutinefunction(func: object) -> TypeGuard[Callable[..., Coroutine[Any, Any, Any]]]: ...
3535
else:
3636
# Sometimes needed in Python < 3.11 due to the fact that it supports @coroutine

stdlib/asyncio/events.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -633,10 +633,10 @@ else:
633633
def new_event_loop(self) -> AbstractEventLoop: ...
634634
# Child processes handling (Unix only).
635635
@abstractmethod
636-
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
636+
@deprecated("Deprecated; removed in Python 3.14.")
637637
def get_child_watcher(self) -> AbstractChildWatcher: ...
638638
@abstractmethod
639-
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
639+
@deprecated("Deprecated; removed in Python 3.14.")
640640
def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ...
641641

642642
AbstractEventLoopPolicy = _AbstractEventLoopPolicy
@@ -657,15 +657,15 @@ if sys.version_info >= (3, 14):
657657
def _get_event_loop_policy() -> _AbstractEventLoopPolicy: ...
658658
def _set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ...
659659

660-
@deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.")
660+
@deprecated("Deprecated; will be removed in Python 3.16.")
661661
def get_event_loop_policy() -> _AbstractEventLoopPolicy: ...
662-
@deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.")
662+
@deprecated("Deprecated; will be removed in Python 3.16.")
663663
def set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ...
664664
def set_event_loop(loop: AbstractEventLoop | None) -> None: ...
665665
def new_event_loop() -> AbstractEventLoop: ...
666666

667667
if sys.version_info < (3, 14):
668-
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
668+
@deprecated("Deprecated; removed in Python 3.14.")
669669
def get_child_watcher() -> AbstractChildWatcher: ...
670-
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
670+
@deprecated("Deprecated; removed in Python 3.14.")
671671
def set_child_watcher(watcher: AbstractChildWatcher) -> None: ...

stdlib/codecs.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ...
193193

194194
def getreader(encoding: str) -> _StreamReader: ...
195195
def getwriter(encoding: str) -> _StreamWriter: ...
196-
@deprecated("Deprecated since Python 3.14. Use `open()` instead.")
196+
@deprecated("Deprecated. Use `open()` instead.")
197197
def open(
198198
filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = -1
199199
) -> StreamReaderWriter: ...

stdlib/ctypes/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ c_buffer = create_string_buffer
168168
def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_wchar]: ...
169169

170170
if sys.version_info < (3, 15):
171-
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
171+
@deprecated("Deprecated; will be removed in Python 3.15.")
172172
def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ...
173173

174-
@deprecated("Soft deprecated since Python 3.13. Use multiplication instead.")
174+
@deprecated("Soft deprecated. Use multiplication instead.")
175175
def ARRAY(typ: _CT, len: int) -> Array[_CT]: ...
176176

177177
if sys.platform == "win32":

stdlib/http/server.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
128128
def executable(path: StrPath) -> bool: ... # undocumented
129129

130130
if sys.version_info < (3, 15):
131-
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
131+
@deprecated("Deprecated and unsafe; will be removed in Python 3.15.")
132132
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
133133
cgi_directories: list[str]
134134
have_fork: bool # undocumented

stdlib/importlib/resources/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ else:
6262
def read_text(package: Package, resource: Resource, encoding: str = "utf-8", errors: str = "strict") -> str: ...
6363
def path(package: Package, resource: Resource) -> AbstractContextManager[Path, Literal[False]]: ...
6464
def is_resource(package: Package, name: str) -> bool: ...
65-
@deprecated("Deprecated since Python 3.11. Use `files(anchor).iterdir()`.")
65+
@deprecated("Deprecated; limited resource support. Use `files(anchor).iterdir()`.")
6666
def contents(package: Package) -> Iterator[str]: ...
6767

6868
if sys.version_info >= (3, 11):

stdlib/importlib/resources/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from typing import IO, Any, Literal, Protocol, overload, runtime_checkable
77
from typing_extensions import deprecated
88

99
if sys.version_info >= (3, 11):
10-
@deprecated("Deprecated since Python 3.12. Use `importlib.resources.abc.TraversableResources` instead.")
10+
@deprecated("Deprecated. Use `importlib.resources.abc.TraversableResources` instead.")
1111
class ResourceReader(metaclass=ABCMeta):
1212
@abstractmethod
1313
def open_resource(self, resource: str) -> IO[bytes]: ...

stdlib/locale.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def getpreferredencoding(do_setlocale: bool = True) -> _str: ...
138138
def normalize(localename: _str) -> _str: ...
139139

140140
if sys.version_info < (3, 13):
141-
@deprecated("Deprecated since Python 3.11; removed in Python 3.13. Use `locale.setlocale(locale.LC_ALL, '')` instead.")
141+
@deprecated("Deprecated; removed in Python 3.13. Use `locale.setlocale(locale.LC_ALL, '')` instead.")
142142
def resetlocale(category: int = ...) -> None: ...
143143

144144
if sys.version_info < (3, 12):

stdlib/nturl2path.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing_extensions import deprecated
22

3-
@deprecated("The `nturl2path` module is deprecated since Python 3.14.")
3+
@deprecated("Deprecated; use `urllib.request` file-URL helpers instead.")
44
def url2pathname(url: str) -> str: ...
5-
@deprecated("The `nturl2path` module is deprecated since Python 3.14.")
5+
@deprecated("Deprecated; use `urllib.request` file-URL helpers instead.")
66
def pathname2url(p: str) -> str: ...

0 commit comments

Comments
 (0)