summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/timeouts.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] gh-111085: Fix invalid state handling in TaskGroup and Timeout ↵Miss Islington (bot)2023-10-211-4/+8
| | | | | | | | | | | | | | | | | | | | (GH-111111) (GH-111172) asyncio.TaskGroup and asyncio.Timeout classes now raise proper RuntimeError if they are improperly used. * When they are used without entering the context manager. * When they are used after finishing. * When the context manager is entered more than once (simultaneously or sequentially). * If there is no current task when entering the context manager. They now remain in a consistent state after an exception is thrown, so subsequent operations can be performed correctly (if they are allowed). (cherry picked from commit 6c23635f2b7067ef091a550954e09f8b7c329e3f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
* gh-102780: Fix uncancel() call in asyncio timeouts (GH-102815)Miss Islington (bot)2023-03-221-3/+4
| | | | | | | | | | Also use `raise TimeOut from <CancelledError instance>` so that the CancelledError is set in the `__cause__` field rather than in the `__context__` field. (cherry picked from commit 04adf2df395ded81922c71360a5d66b597471e49) Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-102810: Add docstrings to the public-facing methods of `asyncio.Timeout` ↵Miss Islington (bot)2023-03-191-0/+12
| | | | | | | | | (GH-102811) (cherry picked from commit 699cb20ae6fdef8b0f13d633cf4858465ef3469f) Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-95051: ensure that timeouts scheduled with `asyncio.Timeout` that have ↵Miss Islington (bot)2022-07-261-4/+4
| | | | | | | | already expired are deliverered promptly (GH-95109) (GH-95216) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> (cherry picked from commit 0c6f898005099be189ee65bcfda659f5fc13b802) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* bpo-46771: Implement asyncio context managers for handling timeouts (GH-31394)Andrew Svetlov2022-03-101-0/+151
Example: async with asyncio.timeout(5): await some_task() Will interrupt the await and raise TimeoutError if some_task() takes longer than 5 seconds. Co-authored-by: Guido van Rossum <guido@python.org>