Skip to content

Commit 87a939f

Browse files
fix: Protocol methods not inherited in python12
1 parent 16301ff commit 87a939f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/thread/_types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class SupportsGetItem(Protocol[_SupportsGetItem_T]):
5757
__getitem__: Callable[..., _SupportsGetItem_T]
5858

5959

60+
# Looks like having this inherit __getitem__ from SupportsGetItem breaks isinstance checks in python3.12
61+
# Thus we explicitly define it
6062
@runtime_checkable
61-
class SupportsLengthGetItem(
62-
SupportsGetItem[_SupportsGetItem_T], SupportsLength, Protocol
63-
):
64-
pass
63+
class SupportsLengthGetItem(Sized, Protocol[_SupportsGetItem_T]):
64+
__getitem__: Callable[..., _SupportsGetItem_T]

0 commit comments

Comments
 (0)