fix: replace deprecated asyncio.get_event_loop() with get_running_loop() in poll_until_finished by Shraman123 · Pull Request #205 · exa-labs/exa-py · GitHub
Skip to content

fix: replace deprecated asyncio.get_event_loop() with get_running_loop() in poll_until_finished - #205

Open
Shraman123 wants to merge 1 commit into
exa-labs:masterfrom
Shraman123:fix/use-get-running-loop-in-async-poll
Open

fix: replace deprecated asyncio.get_event_loop() with get_running_loop() in poll_until_finished#205
Shraman123 wants to merge 1 commit into
exa-labs:masterfrom
Shraman123:fix/use-get-running-loop-in-async-poll

Conversation

@Shraman123

Copy link
Copy Markdown

What this PR fixes

In exa_py/research/async_client.py, poll_until_finished uses asyncio.get_event_loop().time() to track elapsed time.

asyncio.get_event_loop() is deprecated since Python 3.10 when called inside a coroutine. Using it inside an async function emits a DeprecationWarning and may raise a RuntimeError in future Python versions.

The correct replacement when already inside a running async context is asyncio.get_running_loop().

Changes

  • async_client.py: replaced 2 occurrences of asyncio.get_event_loop().time() with asyncio.get_running_loop().time() inside the poll_until_finished coroutine

References

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant