Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Python 3.9 __subclasscheck__ workaround #240

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions python-spec/src/somacore/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
their own internal type-checking purposes.
"""

import sys
from concurrent import futures
from typing import (
TYPE_CHECKING,
NoReturn,
Optional,
Sequence,
Tuple,
Expand Down Expand Up @@ -85,13 +82,6 @@ def stop(self) -> Optional[_T_co]: ...
@property
def step(self) -> Optional[_T_co]: ...

if sys.version_info < (3, 10) and not TYPE_CHECKING:
# Python 3.9 and below have a bug where any Protocol with a @property
# was always regarded as runtime-checkable.
@classmethod
def __subclasscheck__(cls, __subclass: type) -> NoReturn:
raise TypeError("Slice is not a runtime-checkable protocol")


def is_slice_of(__obj: object, __typ: Type[_T]) -> TypeGuard[Slice[_T]]:
return (
Expand Down
Loading