Skip to content

Replace get_event_loop() with get_running_loop() for asyncio compatibility#211

Merged
Knio merged 1 commit intoKnio:masterfrom
thombashi:replace_get_event_loop
Dec 31, 2024
Merged

Replace get_event_loop() with get_running_loop() for asyncio compatibility#211
Knio merged 1 commit intoKnio:masterfrom
thombashi:replace_get_event_loop

Conversation

@thombashi
Copy link
Contributor

@thombashi thombashi commented Dec 31, 2024

Hello,

I got DeprecationWarning: There is no current event loop when using dominate v2.9.1 with Python 3.10 or newer.
ref: thombashi/pytablewriter#66

According to the official Python 3.10 document:

In Python versions 3.10.0–3.10.8 and 3.11.0 this function (and other functions which use it implicitly) emitted a DeprecationWarning if there was no running event loop, even if the current loop was set on the policy. In Python versions 3.10.9, 3.11.1 and 3.12 they emit a DeprecationWarning if there is no running event loop and no current loop is set. In some future Python release this will become an error.

And it was deprecated in Python 3.12:

Deprecated since version 3.12: Deprecation warning is emitted if there is no current event loop. In some future Python release this will become an error.

The document suggests using the get_running_loop() function instead of get_event_loop() function.

This will resolve: #198

…ility

Signed-off-by: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
@coveralls
Copy link

Coverage Status

coverage: 100.0%. remained the same
when pulling b4f4713 on thombashi:replace_get_event_loop
into 82dd9e7 on Knio:master.

@Knio Knio merged commit bdbdb8e into Knio:master Dec 31, 2024
8 checks passed
@thombashi thombashi deleted the replace_get_event_loop branch December 31, 2024 02:34
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.

I run into event loop warnings when running uni tests

3 participants