Skip to content

Conversation

VincentRPS
Copy link
Contributor

Summary

As shown in the docs get_event_loop in 3.10 raises a deprecation warning.
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, typehinting, examples, ...)

@BobDotCom
Copy link
Contributor

Is this backwards compatible with 3.8+?

@VincentRPS
Copy link
Contributor Author

Is this backwards compatible with 3.8+?

it should be, get_running_loop was added in 3.7.

@VincentRPS VincentRPS self-assigned this Jan 13, 2022
@VincentRPS VincentRPS requested a review from BobDotCom January 13, 2022 06:14
@VincentRPS VincentRPS added Merge with rebase priority: medium Medium Priority status: awaiting review Awaiting review from a maintainer labels Jan 13, 2022
@VincentRPS VincentRPS added this to the v2.0 milestone Jan 13, 2022
@VincentRPS VincentRPS modified the milestones: v2.0, v2.1 Jan 21, 2022
Dorukyum
Dorukyum previously approved these changes Jan 21, 2022
@Lulalaby Lulalaby marked this pull request as draft January 21, 2022 12:29
Lulalaby
Lulalaby previously approved these changes Jan 26, 2022
BobDotCom
BobDotCom previously approved these changes Jan 27, 2022
Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com>
@Lulalaby Lulalaby dismissed stale reviews from BobDotCom, Dorukyum, and themself via f6f2d35 January 27, 2022 23:23
@Bimi05
Copy link
Contributor

Bimi05 commented Feb 2, 2022

I recommend you use both new_event_loop and set_event_loop to the loop the latter creates because:

  • get_running_loop returns the running loop or raises an error if none
    in that case, you'd have to create and set a new AbstractEventLoop, just in case there is no running one.

@VincentRPS
Copy link
Contributor Author

I recommend you use both new_event_loop and set_event_loop to the loop the latter creates because:

  • get_running_loop returns the running loop or raises an error if none
    in that case, you'd have to create and set a new AbstractEventLoop, just in case there is no running one.

same thing happens with get_event_loop tho, only difference is it raises a deprecation warning instead of runtime error

@Bimi05
Copy link
Contributor

Bimi05 commented Feb 3, 2022

same thing happens with get_event_loop tho, only difference is it raises a deprecation warning instead of runtime error

Fair enough, but using it plainly would raise a RuntimeError if the running loop is in fact none, so it should be used within a try/except block with the concept of making and assigning a new event loop and then use it. In summary it basically is a coverage because the running loop may be none

@EmmmaTech
Copy link
Contributor

What's the update on this? It's pretty stale by this point.

@Lulalaby
Copy link
Member

Lulalaby commented May 5, 2022

Closing as stale

@Lulalaby Lulalaby closed this May 5, 2022
@Lulalaby Lulalaby deleted the deprecated/get_event_loop branch May 5, 2022 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Medium Priority status: awaiting review Awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants