fix: add type ignore for asyncio.create_task to support Python 3.9 and 3.10

This commit is contained in:
Mason Daugherty 2025-07-21 21:22:16 -04:00
parent 0e0b1f39ca
commit 0a07cde3a2
No known key found for this signature in database

View File

@ -246,7 +246,8 @@ def shielded(func: Func) -> Func:
# For older versions, fallback to original behavior
try:
# Create a task with the captured context to preserve context variables
task = asyncio.create_task(coro, context=ctx)
task = asyncio.create_task(coro, context=ctx) # type: ignore[call-arg]
# `call-arg` used to not fail 3.9 or 3.10 tests
return await asyncio.shield(task)
except TypeError:
# Python < 3.11 fallback - create task normally then shield