Skip to content

gh-142044: Add note to prefer asyncio.timeout[_at] over asyncio.Timeout#144449

Merged
picnixz merged 3 commits intopython:mainfrom
kovan:gh-142044-asyncio-timeout-docs
Feb 7, 2026
Merged

gh-142044: Add note to prefer asyncio.timeout[_at] over asyncio.Timeout#144449
picnixz merged 3 commits intopython:mainfrom
kovan:gh-142044-asyncio-timeout-docs

Conversation

@kovan
Copy link
Contributor

@kovan kovan commented Feb 3, 2026

Summary

  • Adds a note to the Timeout class documentation recommending that users prefer asyncio.timeout() or asyncio.timeout_at() rather than instantiating Timeout directly
  • This matches the guidance already present in the source code docstring at Lib/asyncio/timeouts.py:26-28

Test plan

  • make check passed in Doc/ directory
  • Documentation builds correctly

🤖 Generated with Claude Code


📚 Documentation preview 📚: https://cpython-previews--144449.org.readthedocs.build/

An :ref:`asynchronous context manager <async-context-managers>`
for cancelling overdue coroutines.

.. note::
Copy link
Member

Choose a reason for hiding this comment

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

This note should be placed elsewhere. Either after the class definition or before introducing it.

@bedevere-app
Copy link

bedevere-app bot commented Feb 3, 2026

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

…imeout

Document that users should prefer using asyncio.timeout() or
asyncio.timeout_at() rather than directly instantiating the Timeout
class, matching the guidance already present in the source code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kovan kovan force-pushed the gh-142044-asyncio-timeout-docs branch from 893bb26 to 73df00f Compare February 4, 2026 00:00
@kovan
Copy link
Contributor Author

kovan commented Feb 4, 2026

I have made the requested changes; please review again

@bedevere-app
Copy link

bedevere-app bot commented Feb 4, 2026

Thanks for making the requested changes!

@picnixz: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from picnixz February 4, 2026 00:00
Move the guidance about preferring asyncio.timeout()/timeout_at()
from a .. note:: block into the Timeout class description text,
per reviewer feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kovan
Copy link
Contributor Author

kovan commented Feb 6, 2026

I have made the requested changes; please review again

@bedevere-app
Copy link

bedevere-app bot commented Feb 6, 2026

Thanks for making the requested changes!

@picnixz: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from picnixz February 6, 2026 20:08
@kumaraditya303 kumaraditya303 added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Feb 7, 2026
@picnixz picnixz changed the title gh-142044: Add note to prefer asyncio.timeout/timeout_at over Timeout gh-142044: Add note to prefer asyncio.timeout[_at] over asyncio.Timeout Feb 7, 2026
@picnixz picnixz enabled auto-merge (squash) February 7, 2026 12:18
@picnixz picnixz merged commit 0e7c06a into python:main Feb 7, 2026
29 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Feb 7, 2026
@miss-islington-app
Copy link

Thanks @kovan for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 7, 2026
…cio.Timeout` (pythonGH-144449)

(cherry picked from commit 0e7c06a)

Co-authored-by: kovan <xaum.io@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 7, 2026
…cio.Timeout` (pythonGH-144449)

(cherry picked from commit 0e7c06a)

Co-authored-by: kovan <xaum.io@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Feb 7, 2026

GH-144565 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Feb 7, 2026
@bedevere-app
Copy link

bedevere-app bot commented Feb 7, 2026

GH-144566 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Feb 7, 2026
picnixz pushed a commit that referenced this pull request Feb 7, 2026
…ncio.Timeout` (GH-144449) (#144565)

gh-142044: Add note to prefer `asyncio.timeout[_at]` over `asyncio.Timeout` (GH-144449)
(cherry picked from commit 0e7c06a)

Co-authored-by: kovan <xaum.io@gmail.com>
picnixz pushed a commit that referenced this pull request Feb 7, 2026
…ncio.Timeout` (GH-144449) (#144566)

gh-142044: Add note to prefer `asyncio.timeout[_at]` over `asyncio.Timeout` (GH-144449)
(cherry picked from commit 0e7c06a)

Co-authored-by: kovan <xaum.io@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news topic-asyncio

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants