From be0cb93c7103a5332daf9295b903185612f4e047 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Fri, 12 Jun 2026 20:59:01 -0400 Subject: [PATCH] Add NamedTuple `__match_args__` attribute --- stdlib/_typeshed/_type_checker_internals.pyi | 1 + stdlib/typing.pyi | 1 + 2 files changed, 2 insertions(+) diff --git a/stdlib/_typeshed/_type_checker_internals.pyi b/stdlib/_typeshed/_type_checker_internals.pyi index 8414837f7773..a8411192a898 100644 --- a/stdlib/_typeshed/_type_checker_internals.pyi +++ b/stdlib/_typeshed/_type_checker_internals.pyi @@ -63,6 +63,7 @@ class TypedDictFallback(Mapping[str, object], metaclass=ABCMeta): class NamedTupleFallback(tuple[Any, ...]): _field_defaults: ClassVar[dict[str, Any]] _fields: ClassVar[tuple[str, ...]] + __match_args__: ClassVar[tuple[str, ...]] = ... # __orig_bases__ sometimes exists on <3.12, but not consistently # So we only add it to the stub on 3.12+. if sys.version_info >= (3, 12): diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 054088a9bc19..61439f15e785 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -1049,6 +1049,7 @@ if sys.version_info >= (3, 11): class NamedTuple(tuple[Any, ...]): _field_defaults: ClassVar[dict[str, Any]] _fields: ClassVar[tuple[str, ...]] + __match_args__: ClassVar[tuple[str, ...]] = ... # __orig_bases__ sometimes exists on <3.12, but not consistently # So we only add it to the stub on 3.12+. if sys.version_info >= (3, 12):