Skip to content

[Bug] Python 3.11 TypeError: Passing coroutines is forbidden, use tasks explicitly. #232

@AndrewIngram

Description

@AndrewIngram

The following lines of code run without issue in Python 3.10, but throw in 3.11:

await asyncio.wait(
    [asyncio.sleep((snooze_until - now).total_seconds()), self._is_reopened.wait()],
    return_when=asyncio.FIRST_COMPLETED,
)

(this is similar to an example in the readme, so it seems idiomatic)

The error I get in 3.11 is TypeError: Passing coroutines is forbidden, use tasks explicitly.

Encountered on the python:3.11-slim Docker image, initially using temporalio=0.1b3, reproduced on 0.1b4

I think the relevant Python docs are https://docs.python.org/3/library/asyncio-task.html#waiting-primitives

Passing coroutine objects to wait() directly is forbidden

Not sure if I'd class it as a bug, as the change in Python appears to be deliberate, but it means the canonical way to solve this in Temporal might now be different?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions