Skip to content

Commit 5e567f1

Browse files
authored
Simplify bool stub
The semantics of this proposed PR should be identical to the existing stub. I'm curious, though, to see whether primer shows false-positives like those we saw in python#6762
1 parent 03861b5 commit 5e567f1

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

stdlib/builtins.pyi

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ _TBE = TypeVar("_TBE", bound="BaseException")
7575
_R = TypeVar("_R") # Return-type TypeVar
7676
_SupportsNextT = TypeVar("_SupportsNextT", bound=SupportsNext[Any], covariant=True)
7777
_SupportsAnextT = TypeVar("_SupportsAnextT", bound=SupportsAnext[Any], covariant=True)
78+
_B = TypeVar("_B", bool, int)
7879

7980
class _SupportsIter(Protocol[_T_co]):
8081
def __iter__(self) -> _T_co: ...
@@ -702,30 +703,12 @@ class memoryview(Sized, Sequence[int]):
702703
@final
703704
class bool(int):
704705
def __new__(cls: Type[_T], __o: object = ...) -> _T: ...
705-
@overload
706-
def __and__(self, __x: bool) -> bool: ...
707-
@overload
708-
def __and__(self, __x: int) -> int: ...
709-
@overload
710-
def __or__(self, __x: bool) -> bool: ...
711-
@overload
712-
def __or__(self, __x: int) -> int: ...
713-
@overload
714-
def __xor__(self, __x: bool) -> bool: ...
715-
@overload
716-
def __xor__(self, __x: int) -> int: ...
717-
@overload
718-
def __rand__(self, __x: bool) -> bool: ...
719-
@overload
720-
def __rand__(self, __x: int) -> int: ...
721-
@overload
722-
def __ror__(self, __x: bool) -> bool: ...
723-
@overload
724-
def __ror__(self, __x: int) -> int: ...
725-
@overload
726-
def __rxor__(self, __x: bool) -> bool: ...
727-
@overload
728-
def __rxor__(self, __x: int) -> int: ...
706+
def __and__(self, __x: _B) -> _B: ...
707+
def __or__(self, __x: _B) -> _B: ...
708+
def __xor__(self, __x: _B) -> _B: ...
709+
def __rand__(self, __x: _B) -> _B: ...
710+
def __ror__(self, __x: _B) -> _B: ...
711+
def __rxor__(self, __x: _B) -> _B: ...
729712
def __getnewargs__(self) -> tuple[int]: ...
730713

731714
@final

0 commit comments

Comments
 (0)