Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: python/mypy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.5.0
Choose a base ref
...
head repository: python/mypy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.5.1
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Jul 22, 2023

  1. Copy the full SHA
    373b73a View commit details
  2. Copy the full SHA
    2ff7c0d View commit details

Commits on Aug 11, 2023

  1. Copy the full SHA
    de4f2ad View commit details
Showing with 93 additions and 7 deletions.
  1. +5 −1 mypy/stubtest.py
  2. +4 −0 mypy/typeshed/stdlib/typing.pyi
  3. +83 −5 mypy/typeshed/stdlib/typing_extensions.pyi
  4. +1 −1 mypy/version.py
6 changes: 5 additions & 1 deletion mypy/stubtest.py
Original file line number Diff line number Diff line change
@@ -496,7 +496,11 @@ def verify_typeinfo(
)

# Check everything already defined on the stub class itself (i.e. not inherited)
to_check = set(stub.names)
#
# Filter out non-identifier names, as these are (hopefully always?) whacky/fictional things
# (like __mypy-replace or __mypy-post_init, etc.) that don't exist at runtime,
# and exist purely for internal mypy reasons
to_check = {name for name in stub.names if name.isidentifier()}
# Check all public things on the runtime class
to_check.update(
m for m in vars(runtime) if not is_probably_private(m) and m not in IGNORABLE_CLASS_DUNDERS
4 changes: 4 additions & 0 deletions mypy/typeshed/stdlib/typing.pyi
Original file line number Diff line number Diff line change
@@ -952,3 +952,7 @@ if sys.version_info >= (3, 12):
if sys.version_info >= (3, 10):
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...

if sys.version_info >= (3, 13):
def is_protocol(__tp: type) -> bool: ...
def get_protocol_members(__tp: type) -> frozenset[str]: ...
88 changes: 83 additions & 5 deletions mypy/typeshed/stdlib/typing_extensions.pyi
Original file line number Diff line number Diff line change
@@ -4,35 +4,68 @@ import sys
import typing
from _collections_abc import dict_items, dict_keys, dict_values
from _typeshed import IdentityFunction, Incomplete
from collections.abc import Iterable
from typing import ( # noqa: Y022,Y039
from typing import ( # noqa: Y022,Y037,Y038,Y039
IO as IO,
TYPE_CHECKING as TYPE_CHECKING,
AbstractSet as AbstractSet,
Any as Any,
AnyStr as AnyStr,
AsyncContextManager as AsyncContextManager,
AsyncGenerator as AsyncGenerator,
AsyncIterable as AsyncIterable,
AsyncIterator as AsyncIterator,
Awaitable as Awaitable,
Callable,
BinaryIO as BinaryIO,
Callable as Callable,
ChainMap as ChainMap,
ClassVar as ClassVar,
Collection as Collection,
Container as Container,
ContextManager as ContextManager,
Coroutine as Coroutine,
Counter as Counter,
DefaultDict as DefaultDict,
Deque as Deque,
Mapping,
Dict as Dict,
ForwardRef as ForwardRef,
FrozenSet as FrozenSet,
Generator as Generator,
Generic as Generic,
Hashable as Hashable,
ItemsView as ItemsView,
Iterable as Iterable,
Iterator as Iterator,
KeysView as KeysView,
List as List,
Mapping as Mapping,
MappingView as MappingView,
Match as Match,
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
NoReturn as NoReturn,
Sequence,
Optional as Optional,
Pattern as Pattern,
Reversible as Reversible,
Sequence as Sequence,
Set as Set,
Sized as Sized,
SupportsAbs as SupportsAbs,
SupportsBytes as SupportsBytes,
SupportsComplex as SupportsComplex,
SupportsFloat as SupportsFloat,
SupportsInt as SupportsInt,
SupportsRound as SupportsRound,
Text as Text,
TextIO as TextIO,
Tuple as Tuple,
Type as Type,
Union as Union,
ValuesView as ValuesView,
_Alias,
cast as cast,
no_type_check as no_type_check,
no_type_check_decorator as no_type_check_decorator,
overload as overload,
type_check_only,
)
@@ -109,6 +142,45 @@ __all__ = [
"get_original_bases",
"get_overloads",
"get_type_hints",
"AbstractSet",
"AnyStr",
"BinaryIO",
"Callable",
"Collection",
"Container",
"Dict",
"ForwardRef",
"FrozenSet",
"Generator",
"Generic",
"Hashable",
"IO",
"ItemsView",
"Iterable",
"Iterator",
"KeysView",
"List",
"Mapping",
"MappingView",
"Match",
"MutableMapping",
"MutableSequence",
"MutableSet",
"Optional",
"Pattern",
"Reversible",
"Sequence",
"Set",
"Sized",
"TextIO",
"Tuple",
"Union",
"ValuesView",
"cast",
"get_protocol_members",
"is_protocol",
"no_type_check",
"no_type_check_decorator",
]

_T = typing.TypeVar("_T")
@@ -403,3 +475,9 @@ else:
# Not actually a Protocol at runtime; see
# https://github.com/python/typeshed/issues/10224 for why we're defining it this way
def __buffer__(self, __flags: int) -> memoryview: ...

if sys.version_info >= (3, 13):
from typing import get_protocol_members as get_protocol_members, is_protocol as is_protocol
else:
def is_protocol(__tp: type) -> bool: ...
def get_protocol_members(__tp: type) -> frozenset[str]: ...
2 changes: 1 addition & 1 deletion mypy/version.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
# - Release versions have the form "1.2.3".
# - Dev versions have the form "1.2.3+dev" (PLUS sign to conform to PEP 440).
# - Before 1.0 we had the form "0.NNN".
__version__ = "1.5.0"
__version__ = "1.5.1"
base_version = __version__

mypy_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))