Skip to content

asyncio: updates for 3.11 #7844

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 24 commits into from
May 18, 2022
Merged

asyncio: updates for 3.11 #7844

merged 24 commits into from
May 18, 2022

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented May 17, 2022

@JelleZijlstra JelleZijlstra marked this pull request as draft May 17, 2022 00:29
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

3 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@JelleZijlstra JelleZijlstra marked this pull request as ready for review May 17, 2022 01:55
Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

If we merge #7845 first we'll know whether this got everything ;-)

@github-actions

This comment has been minimized.

@JelleZijlstra JelleZijlstra marked this pull request as draft May 17, 2022 03:10
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@JelleZijlstra
Copy link
Member Author

I have a couple more things to fix tomorrow.

The mypy-primer hit is a true positive: asyncio.run only accepts coroutines, not arbitrary awaitables, and that's been true as far back as 3.7.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood changed the title asyncio.base_events: Add ssl_shutdown_timeout parameter asyncio: updates for 3.11 May 17, 2022
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@JelleZijlstra JelleZijlstra marked this pull request as ready for review May 17, 2022 14:36
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Looks good! I read through the whole thing and compared with the runtime. Just a few small questions/comments.

if sys.version_info >= (3, 11):
def create_task(
self,
coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T],
Copy link
Member

Choose a reason for hiding this comment

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

Should we create an alias somewhere (_typeshed?) for Coroutine[Any, Any, _T] | Generator[Any, None, _T]? I think we could use it quite a lot in our asyncio stubs. (No need to do that in this PR.)

Copy link
Member Author

Choose a reason for hiding this comment

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

It's probably worth checking whether we still need the Generator variant. That feels like a holdover from the pre-await days.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

boostedblob (https://github.com/hauntsaninja/boostedblob)
+ boostedblob/cli.py:29: error: Argument 1 to "run" has incompatible type "Awaitable[T]"; expected "Coroutine[Any, Any, <nothing>]"

@JelleZijlstra JelleZijlstra merged commit eab82c8 into master May 18, 2022
@JelleZijlstra JelleZijlstra deleted the JelleZijlstra-patch-1 branch May 18, 2022 01:11
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.

3 participants