Skip to content

Commit 71d8f5b

Browse files
committed
add sys version check on iscoroutine
1 parent b14b764 commit 71d8f5b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/asyncio/coroutines.pyi

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
import types
23
from collections.abc import Callable, Coroutine
34
from typing import Any, TypeVar
@@ -7,4 +8,7 @@ _F = TypeVar("_F", bound=Callable[..., Any])
78

89
def coroutine(func: _F) -> _F: ...
910
def iscoroutinefunction(func: object) -> bool: ...
10-
def iscoroutine(obj: object) -> TypeGuard[types.GeneratorType[Any, Any, Any] | Coroutine[Any, Any, Any]]: ...
11+
if sys.version_info < (3, 8):
12+
def iscoroutine(obj: object) -> TypeGuard[types.GeneratorType[Any, Any, Any] | Coroutine[Any, Any, Any]]: ...
13+
else:
14+
def iscoroutine(obj: object) -> TypeGuard[Coroutine[Any, Any, Any]]: ...

0 commit comments

Comments
 (0)