We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f3dd81c commit fb6386dCopy full SHA for fb6386d
asyncer/_compat.py
@@ -1,6 +1,5 @@
1
-# AnyIO 4.1.0 renamed cancellable to abandon_on_cancel
2
import sys
3
-from typing import Callable, TypeVar, Union
+from typing import Callable, Tuple, TypeVar, Union
4
5
import anyio
6
import anyio.to_thread
@@ -12,12 +11,16 @@
12
11
else:
13
from importlib.metadata import version as get_version
14
15
-ANYIO_VERSION = get_version("anyio")
+ANYIO_VERSION: Tuple[int, ...] = tuple(
+ int(num) for num in get_version("anyio").split(".")[:3]
16
+)
17
18
T_Retval = TypeVar("T_Retval")
19
PosArgsT = TypeVarTuple("PosArgsT")
20
-if ANYIO_VERSION >= "4.1.0":
21
+
22
+# AnyIO 4.1.0 renamed cancellable to abandon_on_cancel
23
+if ANYIO_VERSION >= (4, 1):
24
25
async def run_sync(
26
func: Callable[[Unpack[PosArgsT]], T_Retval],
0 commit comments