-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-128559: Remove typing import from asyncio.timeouts #128560
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-128559: Remove typing import from asyncio.timeouts #128560
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
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.
News is needed, yeah. Something like "improved import time of asyncio.timeouts
by %amount" should do.
FWIW, I'm not sure we want to keep type annotations here at all. The standard library isn't type-checked, and none of the other asyncio code uses type hints. If it's problematic because of startup times, then that's a convincing argument to remove them from the file entirely.
This won't be reliably measured as a %, this is a flat amount that varies based on whether or not typing.py is currently cached by the operating system, an the % would then vary also based on how many of the other imports an application has, and how many of them are in the os cache, I'll leave out the quantitative claim, but for context even with a warm cache , I've not seen typing ever end up below 45ms with I can remove the type hints entirely if that's preferred, and I'll go ahead with a news entry in a moment |
Misc/NEWS.d/next/Library/2025-01-06-21-35-00.gh-issue-128559.6fxcDM.rst
Outdated
Show resolved
Hide resolved
…fxcDM.rst Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
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.
Thanks, this change looks good to me. Hard to sell that this is a bugfix, so not planning on backporting
This removes the runtime import of the typing module from asyncio.timeouts, decreasing startup time.
I'm not sure if this needs a news entry or more in-depth discussion, or if backports are appropriate here.