[stdlib] Deprecate old functions (#14553)

* [stdlib] Deprecate many functions

* Fix typo

* Imporove message for asyncio/trsock

* Apply suggestions from code review

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Add Python before version

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Wrap comment lines

* fix the rest

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Semyon Moroz
2025-08-10 21:27:35 +00:00
committed by GitHub
parent 91ba0da4aa
commit fb0940e6c1
27 changed files with 163 additions and 34 deletions
+6 -1
View File
@@ -26,7 +26,7 @@ from types import (
WrapperDescriptorType,
)
from typing import Any, ClassVar, Final, Literal, NamedTuple, Protocol, TypeVar, overload, type_check_only
from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard, TypeIs
from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard, TypeIs, deprecated
if sys.version_info >= (3, 14):
from annotationlib import Format
@@ -476,12 +476,14 @@ class Arguments(NamedTuple):
def getargs(co: CodeType) -> Arguments: ...
if sys.version_info < (3, 11):
@deprecated("Deprecated since Python 3.0; removed in Python 3.11.")
class ArgSpec(NamedTuple):
args: list[str]
varargs: str | None
keywords: str | None
defaults: tuple[Any, ...]
@deprecated("Deprecated since Python 3.0; removed in Python 3.11. Use `inspect.signature()` instead.")
def getargspec(func: object) -> ArgSpec: ...
class FullArgSpec(NamedTuple):
@@ -512,6 +514,9 @@ else:
def formatannotationrelativeto(object: object) -> Callable[[object], str]: ...
if sys.version_info < (3, 11):
@deprecated(
"Deprecated since Python 3.5; removed in Python 3.11. Use `inspect.signature()` and the `Signature` class instead."
)
def formatargspec(
args: list[str],
varargs: str | None = None,