Skip to content

Commit e057b9f

Browse files
authored
Add broad definition for c_bool constructor (#14841)
1 parent 7b277d8 commit e057b9f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

stdlib/_typeshed/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ class SupportsIter(Protocol[_T_co]):
142142
class SupportsAiter(Protocol[_T_co]):
143143
def __aiter__(self) -> _T_co: ...
144144

145+
class SupportsLen(Protocol):
146+
def __len__(self) -> int: ...
147+
145148
class SupportsLenAndGetItem(Protocol[_T_co]):
146149
def __len__(self) -> int: ...
147150
def __getitem__(self, k: int, /) -> _T_co: ...

stdlib/ctypes/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ from _ctypes import (
2323
set_errno as set_errno,
2424
sizeof as sizeof,
2525
)
26-
from _typeshed import StrPath
26+
from _typeshed import StrPath, SupportsBool, SupportsLen
2727
from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure
2828
from types import GenericAlias
2929
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload, type_check_only
@@ -217,7 +217,7 @@ class py_object(_CanCastTo, _SimpleCData[_T]):
217217

218218
class c_bool(_SimpleCData[bool]):
219219
_type_: ClassVar[Literal["?"]]
220-
def __init__(self, value: bool = ...) -> None: ...
220+
def __init__(self, value: SupportsBool | SupportsLen | None = ...) -> None: ...
221221

222222
class c_byte(_SimpleCData[int]):
223223
_type_: ClassVar[Literal["b"]]

0 commit comments

Comments
 (0)