Skip to content

Fix deprecated asyncio.get_event_loop() in wait_for_text #6

Description

@gnodet

Summary

wait_for_text() in server.py uses asyncio.get_event_loop() which is deprecated since Python 3.10 and emits a DeprecationWarning in Python 3.12+. It will eventually be removed.

Current code

loop = asyncio.get_event_loop()
deadline = loop.time() + timeout

Fix

loop = asyncio.get_running_loop()
deadline = loop.time() + timeout

Since wait_for_text is an async function, there is always a running event loop when it executes, so get_running_loop() is the correct replacement.

Size

XS — single line change.

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