Skip to content

Add missing asyncio changes from 3.8 whatsnew #16911

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

Merged
merged 8 commits into from
Oct 24, 2019

Conversation

aeros
Copy link
Contributor

@aeros aeros commented Oct 24, 2019

The motivation for this PR was from a request by @1st1 to look for and add missing important changes from the 3.8 whatsnew document.

This includes:

Graduation of asyncio.run() to the stable API and example of its usage. An example is featured because there wasn't one when it was provisionally added in 3.7 and it's a major change to the high-level API of asyncio.

Addition of asyncio.Task.get_coro().

Support for Happy Eyeballs algorithm in asyncio.loop.create_connection().

Deprecation of passing an explicit loop to several functions and class constructors.

Deprecation of passing coroutine objects to asyncio.wait().

Change to asyncio.wait_for() to correctly wait for cancellation of asyncio tasks.

Change to asyncio.BaseTransport.get_extra_info() to return a safe to use socket object.

Graduation of asyncio.BufferedReader to the stable API.

I also moved the ability to name asyncio tasks from "Porting to Python 3.8 > Changes in the Python API" to "Improved Modules > asyncio". This is because the change does not affect the process of upgrading to Python 3.8 and should be in the "Improved Modules > asyncio" section since it's a new feature addition to a commonly used component of asyncio. Also because it added a new method, asyncio.Task.get_name().

I believe this includes all of the missing significant user-facing changes made to asyncio in version 3.8. Let me know if I missed anything @1st1 and @asvetlov.

Copy link
Member

@1st1 1st1 left a comment

Choose a reason for hiding this comment

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

Good job, Kyle. I've left a couple of comments.

@aeros
Copy link
Contributor Author

aeros commented Oct 24, 2019

Good job, Kyle.

Thanks, it should be most of the way there other than a few minor tweaks.

@1st1
Copy link
Member

1st1 commented Oct 24, 2019

Please also mention that CancelledErorr is now a BaseException, right below -m asyncio

@aeros
Copy link
Contributor Author

aeros commented Oct 24, 2019

It looks like the travis CI doc build is failing from the code example not importing asyncio. I thought it was a bit redundant to include that, but I can add it in.

@aeros
Copy link
Contributor Author

aeros commented Oct 24, 2019

@1st1

Please also mention that CancelledErorr is now a BaseException, right below -m asyncio

This is already mentioned in the section "Porting to Python 3.8 > Changes to the Python API". Just to make sure, would you prefer for it to be in "Improved Modules > asyncio" (in the location you specified) instead? Personally I think either section would be okay, I don't have a particularly strong preference in this case.

@1st1
Copy link
Member

1st1 commented Oct 24, 2019

This is already mentioned in the section "Porting to Python 3.8 > Changes to the Python API". Just to make sure, would you prefer for it to be in "Improved Modules > asyncio" (in the location you specified) instead?

Let's mention in both places. It's the most breaking/important change in 3.8 (and ever for asyncio)

@aeros
Copy link
Contributor Author

aeros commented Oct 24, 2019

While copying the asyncio.CancelledError change to BaseException entry, I noticed that it linked to the incorrect issue in the "Contributed by". In current version on master, it links to https://bugs.python.org/issue13528. I'm fixing both the old and new one to link to the correct bpo issue, https://bugs.python.org/issue32528.

I wouldn't say this is critical, but it's important that users are able to easily locate the context and reasoning behind the changes (especially for something breaking like this).

Edit: Also made a minor grammar typo fix:
"... now inherits from BaseException rather than a Exception."
->
"... now inherits from BaseException rather than Exception."

@1st1
Copy link
Member

1st1 commented Oct 24, 2019

LMK when this is ready for merge.

@aeros
Copy link
Contributor Author

aeros commented Oct 24, 2019

@1st1 I just finished double checking the Sphinx rendering from all of the new changes and I believe we covered everything. The only thing I can think of would be waiting for @asvetlov to look over the entries to make sure we didn't miss any significant asyncio changes. But, I recall that he might be otherwise occupied until Friday, so we might want to just move forward with merging these changes.

I think there's definitely some value in having the changes out sooner so that any current readers don't miss out on important changes, particularly the deprecations.

@1st1
Copy link
Member

1st1 commented Oct 24, 2019

I think there's definitely some value in having the changes out sooner so that any current readers don't miss out on important changes, particularly the deprecations.

Yes. I do hope that @asvetlov reviews this when he has time, but don't want (a) for people not to know about asyncio changes; (b) put any stress on Andrew.

@1st1 1st1 merged commit 3bbb6db into python:master Oct 24, 2019
@miss-islington
Copy link
Contributor

Thanks @aeros for the PR, and @1st1 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@1st1
Copy link
Member

1st1 commented Oct 24, 2019

Thank you, Kyle! 🚀

@bedevere-bot
Copy link

GH-16912 is a backport of this pull request to the 3.8 branch.

miss-islington added a commit that referenced this pull request Oct 24, 2019
(cherry picked from commit 3bbb6db)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants