From f8eb601d66030cb8b87421ce84d1ac8813088c6c Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 10 Jun 2026 08:56:26 -0700 Subject: [PATCH 1/2] Add Python 3.15 TypedDict attributes --- stdlib/_typeshed/_type_checker_internals.pyi | 4 ++++ stdlib/typing.pyi | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/stdlib/_typeshed/_type_checker_internals.pyi b/stdlib/_typeshed/_type_checker_internals.pyi index 375e997e2c93..53862419fefa 100644 --- a/stdlib/_typeshed/_type_checker_internals.pyi +++ b/stdlib/_typeshed/_type_checker_internals.pyi @@ -28,6 +28,10 @@ class TypedDictFallback(Mapping[str, object], metaclass=ABCMeta): if sys.version_info >= (3, 13): __readonly_keys__: ClassVar[frozenset[str]] __mutable_keys__: ClassVar[frozenset[str]] + if sys.version_info >= (3, 15): + # PEP 728 + __closed__: ClassVar[bool | None] + __extra_items__: ClassVar[Any] # AnnotationForm def copy(self) -> typing_extensions.Self: ... # Using Never so that only calls using mypy plugin hook that specialize the signature diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 2018a835c632..e947df516860 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -1082,6 +1082,10 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta): if sys.version_info >= (3, 13): __readonly_keys__: ClassVar[frozenset[str]] __mutable_keys__: ClassVar[frozenset[str]] + if sys.version_info >= (3, 15): + # PEP 728 + __closed__: ClassVar[bool | None] + __extra_items__: ClassVar[Any] # AnnotationForm def copy(self) -> typing_extensions.Self: ... # Using Never so that only calls using mypy plugin hook that specialize the signature From 5c465005758c240ec3b7c9e6fd67d35248c6f6c7 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 10 Jun 2026 09:21:58 -0700 Subject: [PATCH 2/2] Use AnnotationForm for TypedDict extra items --- stdlib/_typeshed/_type_checker_internals.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/_typeshed/_type_checker_internals.pyi b/stdlib/_typeshed/_type_checker_internals.pyi index 53862419fefa..8414837f7773 100644 --- a/stdlib/_typeshed/_type_checker_internals.pyi +++ b/stdlib/_typeshed/_type_checker_internals.pyi @@ -5,6 +5,7 @@ import sys import typing_extensions from _collections_abc import dict_items, dict_keys, dict_values +from _typeshed import AnnotationForm from abc import ABCMeta from collections.abc import Awaitable, Generator, Iterable, Mapping from typing import Any, ClassVar, Generic, TypeVar, overload @@ -31,7 +32,7 @@ class TypedDictFallback(Mapping[str, object], metaclass=ABCMeta): if sys.version_info >= (3, 15): # PEP 728 __closed__: ClassVar[bool | None] - __extra_items__: ClassVar[Any] # AnnotationForm + __extra_items__: ClassVar[AnnotationForm] def copy(self) -> typing_extensions.Self: ... # Using Never so that only calls using mypy plugin hook that specialize the signature