mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-09-11 18:07:24 +00:00
Fix pyright annotation issue for __qualname__ (#959)
This commit is contained in:
@@ -138,7 +138,17 @@ class PluginManager:
|
||||
tasks = all_tasks()
|
||||
current = current_task()
|
||||
async def cancel_task(task: Task[Any]):
|
||||
name = task.get_coro().__qualname__
|
||||
task_coro = task.get_coro()
|
||||
if not task_coro:
|
||||
# Can be None in case asyncio.eager_task_factory is used in the future
|
||||
return
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
name = task_coro.__qualname__
|
||||
else:
|
||||
# Before 3.12, the task_coro can be a generator and apparently it does not
|
||||
# have __qualname__, so this workaround is needed...
|
||||
name = getattr(task_coro, "__qualname__", task.get_name())
|
||||
logger.debug(f"Cancelling task {name}")
|
||||
try:
|
||||
task.cancel()
|
||||
|
||||
Reference in New Issue
Block a user