From dcaea8bf06191d00c51a73fd932af09097cf208a Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 30 Dec 2020 14:31:40 -0800 Subject: [PATCH] Add TypeGuard (PEP 647 draft) (#4879) --- stdlib/3/typing.pyi | 1 + third_party/2and3/typing_extensions.pyi | 3 +++ 2 files changed, 4 insertions(+) diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index b74a5435f..a2ed53cf9 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -61,6 +61,7 @@ if sys.version_info >= (3, 10): def __init__(self, name: str) -> None: ... Concatenate: _SpecialForm = ... TypeAlias: _SpecialForm = ... + TypeGuard: _SpecialForm = ... # Return type that indicates a function does not return. # This type is equivalent to the None type, but the no-op Union is necessary to diff --git a/third_party/2and3/typing_extensions.pyi b/third_party/2and3/typing_extensions.pyi index aec0f9440..f103a0faf 100644 --- a/third_party/2and3/typing_extensions.pyi +++ b/third_party/2and3/typing_extensions.pyi @@ -112,3 +112,6 @@ else: __name__: str def __init__(self, name: str) -> None: ... Concatenate: _SpecialForm = ... + +# PEP 647 +TypeGuard: _SpecialForm = ...