Skip to content

Commit

Permalink
iterating
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Sep 16, 2024
1 parent 79fa1e4 commit d37aae3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions python-spec/src/somacore/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import sys
from concurrent import futures
from typing import TYPE_CHECKING, Any, NoReturn, Optional, Sequence, Type, TypeVar
from types import get_original_bases # only exists in Python 3.12 and above

from typing_extensions import Protocol, TypeGuard


Expand Down Expand Up @@ -58,9 +56,15 @@ def stop(self) -> Optional[_T_co]: ...
@property
def step(self) -> Optional[_T_co]: ...

@property
def __orig_bases__(self) -> Any:
return get_original_bases(_T_co)
if sys.version_info >= (3, 12):

@property
def __orig_bases__(self) -> Any:
# Only exists in Python 3.12 and above
from types import get_original_bases

return get_original_bases(int)
# return get_original_bases(_T_co)

if sys.version_info < (3, 10) and not TYPE_CHECKING:
# Python 3.9 and below have a bug where any Protocol with an @property
Expand Down

0 comments on commit d37aae3

Please sign in to comment.