Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-93896: restore the set_event_loop calls to asyncio.run #94058

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Jun 21, 2022

@graingert graingert changed the title restore the set_event_loop calls to asyncio.run #93896 restore the set_event_loop calls to asyncio.run Jun 21, 2022
if sys.platform == "win32":
from .windows_events import ProactorEventLoop as _new_event_loop
else:
from .unix_events import SelectorEventLoop as _new_event_loop
Copy link
Contributor Author

@graingert graingert Jun 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this opts asyncio.Runner out of the policy system and asyncio.run opts back in

@graingert graingert changed the title #93896 restore the set_event_loop calls to asyncio.run #gh-93896 restore the set_event_loop calls to asyncio.run Jun 21, 2022
@graingert graingert changed the title #gh-93896 restore the set_event_loop calls to asyncio.run #gh-93896: restore the set_event_loop calls to asyncio.run Jun 21, 2022
@graingert graingert changed the title #gh-93896: restore the set_event_loop calls to asyncio.run gh-93896: restore the set_event_loop calls to asyncio.run Jun 21, 2022
Lib/asyncio/runners.py Outdated Show resolved Hide resolved
Lib/asyncio/runners.py Outdated Show resolved Hide resolved
@graingert graingert force-pushed the restore-set-event-loop-policy-to-asyncio-run branch from f21f808 to abbd6b4 Compare Jun 22, 2022
Lib/unittest/async_case.py Outdated Show resolved Hide resolved
@graingert graingert marked this pull request as ready for review Jun 22, 2022
@graingert graingert requested review from 1st1 and asvetlov as code owners Jun 22, 2022
If set_policy_loop is True, the event loop in the default policy will be
set.
Copy link
Contributor

@Bluenix2 Bluenix2 Jun 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is classified as a bug (clearly it is causing issues), then fixing it shouldn't be blocking. By only implementing this behind an argument we are introducing a new feature which means that this will only be added to 3.12 (and not 3.11).

I would vote for not adding this argument.

Copy link
Contributor Author

@graingert graingert Jun 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's important to maintain the asyncio.Runner support for a high level policy-free use of asyncio, so that the policy system can be deprecated and removed

This function always creates a new event loop from the default policy sets
it in the event loop policy and closes it at the end and sets the policy
loop to None.
Copy link
Contributor

@Bluenix2 Bluenix2 Jun 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This long sentence is quite wordy and without knowing the change I would probably not understand what it means.

I would probably suggest not making this change (referring to this very sentence). To most, setting the loop in the event loop policy is probably synonymous to actually creating and running a loop.

…sYCX.rst

Co-authored-by: Bluenix <bluenixdev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants