From 0d2c2fea78050c1c2829df9fd221e1729980e5a6 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Wed, 22 Jul 2026 13:51:36 +0800 Subject: [PATCH] commit --- stdlib/builtins.pyi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index fbecb8454ae0..d6be9a801da6 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1055,6 +1055,16 @@ class memoryview(Sequence[_I]): class bool(int): def __new__(cls, o: object = False, /) -> Self: ... + @overload + def __int__(self: Literal[True]) -> Literal[1]: ... + @overload + def __int__(self: Literal[False]) -> Literal[0]: ... + + @overload + def __index__(self: Literal[True]) -> Literal[1]: ... + @overload + def __index__(self: Literal[False]) -> Literal[0]: ... + # The following overloads could be represented more elegantly with a TypeVar("_B", bool, int), # however mypy has a bug regarding TypeVar constraints (https://github.com/python/mypy/issues/11880). @overload