From f3026dc3ab13f03fa331f494ddd52348c6b68cc3 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 13 Dec 2021 16:59:31 +0000 Subject: [PATCH] Improve `enum.StrEnum` (#6580) A `StrEnum` can only have strings as values. --- stdlib/enum.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 374e9a3c5..f4ce81eaf 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -174,7 +174,9 @@ class IntFlag(int, Flag): if sys.version_info >= (3, 11): class StrEnum(str, Enum): - def __new__(cls: Type[_T], value: int | _T) -> _T: ... + def __new__(cls: Type[_T], value: str | _T) -> _T: ... + @property + def value(self) -> str: ... class FlagBoundary(StrEnum): STRICT: str CONFORM: str