Skip to content

Commit e81309e

Browse files
PEP 702: decorator is in warnings, not typing-extensions (#16488)
Followup from https://github.com/python/mypy/pull/16457/files#r1392715784
1 parent 6cbdab8 commit e81309e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

mypy/test/teststubtest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class Tuple(Sequence[_T_co]): ...
7272
class NamedTuple(tuple[Any, ...]): ...
7373
def overload(func: _T) -> _T: ...
7474
def type_check_only(func: _T) -> _T: ...
75-
def deprecated(__msg: str) -> Callable[[_T], _T]: ...
7675
def final(func: _T) -> _T: ...
7776
"""
7877

@@ -635,7 +634,8 @@ def f5(__b: str) -> str: ...
635634
)
636635
yield Case(
637636
stub="""
638-
from typing import deprecated, final
637+
from typing import final
638+
from typing_extensions import deprecated
639639
class Foo:
640640
@overload
641641
@final

mypy/types.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
ANNOTATED_TYPE_NAMES: Final = ("typing.Annotated", "typing_extensions.Annotated")
124124

125125
# Supported @deprecated type names
126-
DEPRECATED_TYPE_NAMES: Final = ("typing.deprecated", "typing_extensions.deprecated")
126+
DEPRECATED_TYPE_NAMES: Final = ("warnings.deprecated", "typing_extensions.deprecated")
127127

128128
# We use this constant in various places when checking `tuple` subtyping:
129129
TUPLE_LIKE_INSTANCE_NAMES: Final = (

test-data/unit/lib-stub/typing_extensions.pyi

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import typing
2-
from typing import Any, Mapping, Iterable, Iterator, NoReturn as NoReturn, Dict, Tuple, Type
2+
from typing import Any, Callable, Mapping, Iterable, Iterator, NoReturn as NoReturn, Dict, Tuple, Type
33
from typing import TYPE_CHECKING as TYPE_CHECKING
44
from typing import NewType as NewType, overload as overload
55

@@ -75,5 +75,6 @@ def dataclass_transform(
7575
) -> Callable[[T], T]: ...
7676

7777
def override(__arg: _T) -> _T: ...
78+
def deprecated(__msg: str) -> Callable[[_T], _T]: ...
7879

7980
_FutureFeatureFixture = 0

0 commit comments

Comments
 (0)