-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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-102810 Improve the sphinx docs for asyncio.Timeout
#102934
gh-102810 Improve the sphinx docs for asyncio.Timeout
#102934
Conversation
- Add a note recommending the use of the async context factories timeout() and timeout_at() - Add the missing argument to the class definition - Add a description of what the when param does, and it's possible values.
Thank you! FYI we get docs previews on PRs (you can access it via the "details" button on the "netlify" check down at the bottom), so there's no need to post screenshots on a docs PR :) |
Co-authored-by: Alex Waygood <[email protected]>
@AlexWaygood, thanks for the review - I somehow missed that repetition in my self-review.. I suppose my brain was just de-duplicating it subconsciously! (Or more likely I'm sleepy 💤) |
Co-authored-by: Alex Waygood <[email protected]>
On a somewhat unrelated note: it occurred to me that it's potentially confusing to have For instance I'm sure one or more people will accidentally use one instead of the other, like so: async with asyncio.Timeout(1): # Most likely this `when` has already expired, since `when < loop.time()`
await asyncio.sleep(0) # raises a `TimeoutError`
async with asyncio.timeout(1): # This is most likely what the user wants
await asyncio.sleep(0) # Behaves as intended I wonder if perhaps something can be done to ameliorate this. If people agree this is problematic I can open a separate issue. |
Co-authored-by: Alex Waygood <[email protected]>
As you say, the behaviour of |
The Timeout class is not the recommended API. But it is just public enough that we can’t change it. |
asyncio.Timeout
asyncio.Timeout
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
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 great to me, thanks @JosephSBoyle! Will wait to see if Guido has any final thoughts before merging
Thanks @JosephSBoyle for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
…GH-102934) (cherry picked from commit f13fdac) Co-authored-by: JosephSBoyle <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
GH-102958 is a backport of this pull request to the 3.11 branch. |
(cherry picked from commit f13fdac) Co-authored-by: JosephSBoyle <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
…#102934) Co-authored-by: Alex Waygood <[email protected]>
…#102934) Co-authored-by: Alex Waygood <[email protected]>
I've drafted a PR of some updates to the sphinx docs, as requested on a prev. PR for this issue by @AlexWaygood[0].
timeout()
andtimeout_at()
when
param does, and it's possible values.[0]. #102811 (comment)