Skip to content

Replace deprecated asyncio.get_event_loop() with asyncio.run() - #1

Merged
KimmyXYC merged 1 commit into
KimmyXYC:mainfrom
na1oh:fix/use-asyncio-run
Feb 19, 2026
Merged

Replace deprecated asyncio.get_event_loop() with asyncio.run()#1
KimmyXYC merged 1 commit into
KimmyXYC:mainfrom
na1oh:fix/use-asyncio-run

Conversation

@na1oh

@na1oh na1oh commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Description

The asyncio.get_event_loop() method is deprecated since Python 3.10.
Using asyncio.run() is the modern and recommended way to run async code.

Changes

  • Replaced asyncio.get_event_loop().run_until_complete(main()) with asyncio.run(main())
  • Added if __name__ == '__main__': guard for better module import safety

Benefits

  • Automatically handles event loop creation and cleanup
  • Provides better compatibility with modern Python versions
  • Fixes potential DeprecationWarning
  • Follows Python best practices

Checklist

  • Code follows project style
  • Tested locally (code is functionally equivalent)
  • Commit message is clear
  • PR description is detailed

The asyncio.get_event_loop() method is deprecated since Python 3.10.
Using asyncio.run() is the modern and recommended way to run async code.

This change:
- Uses asyncio.run(main()) instead of asyncio.get_event_loop().run_until_complete(main())
- Automatically handles event loop creation and cleanup
- Provides better compatibility with modern Python versions

Fixes potential DeprecationWarning and follows Python best practices.
@KimmyXYC
KimmyXYC merged commit 5866ef7 into KimmyXYC:main Feb 19, 2026
1 check passed
KimmyXYC added a commit that referenced this pull request Feb 19, 2026
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.

2 participants