-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this 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 ;-)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I have a couple more things to fix tomorrow. The mypy-primer hit is a true positive: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
asyncio
: updates for 3.11
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this 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.
stdlib/asyncio/base_events.pyi
Outdated
if sys.version_info >= (3, 11): | ||
def create_task( | ||
self, | ||
coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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.
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>]"
|
CPython changes: