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

[3.11] gh-93453: Only emit deprecation warning in asyncio.get_event_loop when a new event loop is created #99949

Merged
merged 6 commits into from
Dec 6, 2022

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Dec 2, 2022

It no longer emits a deprecation warning if the current event loop was set.

…op when a new event loop is created

It no longer emits a deprecation warning if the current event loop was set.
@serhiy-storchaka serhiy-storchaka changed the title gh-93453: Only emit deprecation warning in asyncio.get_event_loop when a new event loop is created [3.11] gh-93453: Only emit deprecation warning in asyncio.get_event_loop when a new event loop is created Dec 2, 2022
@ambv
Copy link
Contributor

ambv commented Dec 5, 2022

This will need to also be backported to 3.10. In the light of that, I'm nervous about the removal of _asyncio._get_event_loop here. The point of the change as named in the PR is to stop emitting deprecation warnings when a loop exists on the policy. Serhiy's comment here explains this intent as well:
#98440 (comment)

@serhiy-storchaka, @gvanrossum, @kumaraditya303: would you be okay if I changed this PR to keep _asyncio._get_event_loop intact? I think that makes more sense for a change that's supposed to land in 3.10.9 too.

@ambv
Copy link
Contributor

ambv commented Dec 5, 2022

Note that I'm fine with _get_event_loop() to disappear in 3.12 as it's an underscored name. I simply think it's going to be disruptive to change this in 3.11.1 and 3.10.9.

(I also resolved a conflict in any case to have CI green.)

@serhiy-storchaka
Copy link
Member Author

I do not think it is necessary, but I have no objections.

@ambv
Copy link
Contributor

ambv commented Dec 5, 2022

OK, @serhiy-storchaka, then I'll adapt this PR to leave _asyncio._get_event_loop existing.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Do read my comments first!

Doc/library/asyncio-eventloop.rst Show resolved Hide resolved
Doc/library/asyncio-policy.rst Outdated Show resolved Hide resolved
Lib/asyncio/events.py Show resolved Hide resolved
@serhiy-storchaka
Copy link
Member Author

I afraid that I can create conflicts with Łukasz, so from now I'm stopping committing in this branch. In any case my internet connection is currently too bad and can disappear at any time.

@ambv
Copy link
Contributor

ambv commented Dec 6, 2022

Thanks, @serhiy-storchaka, I reverted removal of asyncio.events._get_event_loop and _asyncio._get_event_loop. Look how obvious the remaining changes now look in the "Files changed" tab. I like this.

I will wait for everything to pass and then merge this to create a 3.10 backport.

@ambv ambv added the needs backport to 3.10 only security fixes label Dec 6, 2022
@ambv ambv merged commit 3fae04b into python:3.11 Dec 6, 2022
@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @serhiy-storchaka and @ambv, I had trouble checking out the 3.10 backport branch.
Please retry by removing and re-adding the "needs backport to 3.10" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker 3fae04b10e2655a20a3aadb5e0d63e87206d0c67 3.10

@ambv
Copy link
Contributor

ambv commented Dec 6, 2022

Note: I'm working on the backport now manually, there's some test conflicts with 3.10.

Now backporting '3fae04b10e2655a20a3aadb5e0d63e87206d0c67' into '3.10'
Error cherry-pick 3fae04b10e2655a20a3aadb5e0d63e87206d0c67.
Auto-merging Doc/library/asyncio-eventloop.rst
Auto-merging Doc/library/asyncio-llapi-index.rst
Auto-merging Lib/asyncio/events.py
Auto-merging Lib/test/test_asyncio/test_base_events.py
Auto-merging Lib/test/test_asyncio/test_events.py
CONFLICT (content): Merge conflict in Lib/test/test_asyncio/test_events.py
Auto-merging Lib/test/test_asyncio/test_futures.py
CONFLICT (content): Merge conflict in Lib/test/test_asyncio/test_futures.py
Auto-merging Lib/test/test_asyncio/test_streams.py
CONFLICT (content): Merge conflict in Lib/test/test_asyncio/test_streams.py
Auto-merging Lib/test/test_asyncio/test_tasks.py
CONFLICT (content): Merge conflict in Lib/test/test_asyncio/test_tasks.py
Auto-merging Lib/test/test_coroutines.py
Auto-merging Modules/_asynciomodule.c
error: could not apply 3fae04b10e... [3.11] gh-93453: Only emit deprecation warning in asyncio.get_event_loop when a new event loop is created (#99949)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

ambv pushed a commit to ambv/cpython that referenced this pull request Dec 6, 2022
…o.get_event_loop when a new event loop is created (pythonGH-99949)

It no longer emits a deprecation warning if the current event loop was set.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 3fae04b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs backport to 3.10 only security fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants