Skip to content

Unexpected return value in function toast_async #60

@better-er

Description

@better-er

return result at pos2 should be removed as:

  1. docstring at pos1 claims return None
  2. the use of 'return' inside a 'finally' clause is not supported in Python version 3.14
  3. result is a global viriable and is not used directly in this function
async def toast_async(...):
    """
    Notify
    Args:
        ...
    Returns:
        None  <-- pos1
    """
    ...
    try:
        _, pending = await asyncio.wait(futures, return_when=asyncio.FIRST_COMPLETED)
        for p in pending:
            p.cancel()
    finally:
        if activated_token is not None:
            notification.remove_activated(activated_token)
        if dismissed_token is not None:
            notification.remove_dismissed(dismissed_token)
        if failed_token is not None:
            notification.remove_failed(failed_token)
        return result  <-- pos2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions