Skip to content

mypy does not complain about async functions that do not return values #12837

Description

@hauntsaninja

Found as part of #12834

In the following, you'd expect mypy to complain about assigning to await async_nothing, like it does with the synchronous case. Note that mypy does in fact complain about this using the old asyncio.coroutine yield from coroutines, see testErrorAssigningCoroutineThatDontReturn (prior to #12834).

def nothing() -> None:
    ...

def foo() -> None:
    x = nothing()  # E: "nothing" does not return a value

async def async_nothing() -> None:
    ...

async def async_foo() -> None:
    x = await async_nothing()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions