From 319ac41aceac354b0307082e6470341c37142d87 Mon Sep 17 00:00:00 2001 From: guoci Date: Fri, 28 Nov 2025 16:58:38 -0500 Subject: [PATCH] [stdlib] In `typing.NewType`, add `__name__` attribute --- stdlib/typing.pyi | 1 + stdlib/typing_extensions.pyi | 1 + 2 files changed, 2 insertions(+) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 953c132aea4f..3c3bf30f83b7 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -387,6 +387,7 @@ if sys.version_info >= (3, 10): def __or__(self, other: Any) -> _SpecialForm: ... def __ror__(self, other: Any) -> _SpecialForm: ... __supertype__: type | NewType + __name__: str else: def NewType(name: str, tp: Any) -> Any: ... diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index 5fd3f4578a8b..8a9f0f3919ba 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -376,6 +376,7 @@ else: def __init__(self, name: str, tp: AnnotationForm) -> None: ... def __call__(self, obj: _T, /) -> _T: ... __supertype__: type | NewType + __name__: str if sys.version_info >= (3, 10): def __or__(self, other: Any) -> _SpecialForm: ... def __ror__(self, other: Any) -> _SpecialForm: ...