We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 78626db commit 0227077Copy full SHA for 0227077
1 file changed
asyncer/_compat.py
@@ -9,6 +9,11 @@
9
T_Retval = TypeVar("T_Retval")
10
PosArgsT = TypeVarTuple("PosArgsT")
11
12
+# Use abandon_on_cancel if available
13
+RUN_SYNC_AOC = (
14
+ "abandon_on_cancel" in inspect.getfullargspec(anyio.to_thread.run_sync).kwonlyargs
15
+)
16
+
17
18
async def run_sync(
19
func: Callable[[Unpack[PosArgsT]], T_Retval],
@@ -17,10 +22,7 @@ async def run_sync(
22
limiter: Union[CapacityLimiter, None] = None,
23
) -> T_Retval:
24
# AnyIO 4.1.0 renamed cancellable to abandon_on_cancel
20
- if (
21
- "abandon_on_cancel"
- in inspect.getfullargspec(anyio.to_thread.run_sync).kwonlyargs
- ):
25
+ if RUN_SYNC_AOC:
26
return await anyio.to_thread.run_sync(
27
func, *args, abandon_on_cancel=abandon_on_cancel, limiter=limiter
28
)
0 commit comments