Skip to content

Commit

Permalink
PEP 702: decorator is in warnings, not typing-extensions (#16488)
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored Nov 18, 2023
1 parent 6cbdab8 commit e81309e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mypy/test/teststubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class Tuple(Sequence[_T_co]): ...
class NamedTuple(tuple[Any, ...]): ...
def overload(func: _T) -> _T: ...
def type_check_only(func: _T) -> _T: ...
def deprecated(__msg: str) -> Callable[[_T], _T]: ...
def final(func: _T) -> _T: ...
"""

Expand Down Expand Up @@ -635,7 +634,8 @@ def f5(__b: str) -> str: ...
)
yield Case(
stub="""
from typing import deprecated, final
from typing import final
from typing_extensions import deprecated
class Foo:
@overload
@final
Expand Down
2 changes: 1 addition & 1 deletion mypy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
ANNOTATED_TYPE_NAMES: Final = ("typing.Annotated", "typing_extensions.Annotated")

# Supported @deprecated type names
DEPRECATED_TYPE_NAMES: Final = ("typing.deprecated", "typing_extensions.deprecated")
DEPRECATED_TYPE_NAMES: Final = ("warnings.deprecated", "typing_extensions.deprecated")

# We use this constant in various places when checking `tuple` subtyping:
TUPLE_LIKE_INSTANCE_NAMES: Final = (
Expand Down
3 changes: 2 additions & 1 deletion test-data/unit/lib-stub/typing_extensions.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import typing
from typing import Any, Mapping, Iterable, Iterator, NoReturn as NoReturn, Dict, Tuple, Type
from typing import Any, Callable, Mapping, Iterable, Iterator, NoReturn as NoReturn, Dict, Tuple, Type
from typing import TYPE_CHECKING as TYPE_CHECKING
from typing import NewType as NewType, overload as overload

Expand Down Expand Up @@ -75,5 +75,6 @@ def dataclass_transform(
) -> Callable[[T], T]: ...

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

_FutureFeatureFixture = 0

0 comments on commit e81309e

Please sign in to comment.